Java

Class Not Found Empty Test Suite in IntelliJ

27 September 2026 · 7 min read

Class Not Found Empty Test Suite in IntelliJ

Encountering a “Class Not Found: Empty Test Suite in IntelliJ” error can be one of the most frustrating hurdles for Java developers. It’s a cryptic message that often sends even experienced programmers down a rabbit hole of debugging. This error typically signifies that IntelliJ IDEA, or more precisely, the Java Virtual Machine (JVM) it invokes, cannot locate the specified test class or, once found, determines that it contains no runnable tests. It effectively halts your development workflow, preventing you from verifying code changes and ensuring software quality. Understanding the root causes of this seemingly simple error is crucial for efficient troubleshooting and maintaining a smooth development environment.

Understanding the “Class Not Found: Empty Test Suite” Error

The “Class Not Found: Empty Test Suite” error in IntelliJ IDEA is a specific symptom indicating that the test runner initiated by IntelliJ failed to execute your tests. This can happen for two primary reasons: either the JVM literally cannot find the compiled test class file on its classpath, or it finds the class but determines that it does not contain any valid test methods that can be executed by the chosen test framework (like JUnit or TestNG).

When IntelliJ attempts to run a test, it compiles your source code, places the compiled .class files into an output directory, and then instructs the JVM to load and execute the relevant test classes. If the path to these compiled classes isn’t correctly configured in the project’s classpath, the JVM will report a “Class Not Found” exception. Alternatively, if the class is found but lacks the necessary annotations (e.g., @Test for JUnit 4/5) or extends the wrong base class, the test runner might interpret it as an “Empty Test Suite.” According to a report by JetBrains’ Developer Ecosystem Survey 2023, Java remains a dominant language, and robust testing frameworks are integral to its ecosystem, making proper configuration essential.

This error is particularly common after project imports, dependency updates, or changes to the build system configuration (Maven, Gradle). It’s a strong indicator of a discrepancy between your project’s intended structure and what IntelliJ or the underlying build tool perceives. Resolving it often involves a methodical check of your project setup, ensuring all components are correctly aligned for test execution.

Infographic here
Common Causes and Diagnoses ---------------------------

Diagnosing the “Class Not Found: Empty Test Suite in IntelliJ” error requires a systematic approach, as several factors can contribute to it. The key is to check all potential points of failure, from project structure to specific run configurations. Understanding these common causes will significantly reduce your debugging time.

Missing or Misconfigured Dependencies/Libraries

One of the most frequent culprits is the absence or incorrect version of test framework dependencies. For instance, if you’re using JUnit, ensure that junit-jupiter-api, junit-jupiter-engine, and junit-platform-runner (for JUnit 5) or junit:junit (for JUnit 4) are correctly declared in your pom.xml (Maven) or build.gradle (Gradle) file and that IntelliJ has successfully imported them. Without these, the test runner simply won’t recognize your @Test annotations.

Incorrect Project Structure or Source Roots

IntelliJ relies on correctly marked source roots to identify where your main code and test code reside. Navigate to File > Project Structure > Modules > Sources. Ensure that your test directories (commonly src/test/java) are marked as “Test Sources Root” (usually in green). If these folders are not correctly identified, IntelliJ won’t compile your test classes into the appropriate output directory, leading to a Class Not Found error.

Classpath Configuration Issues

The classpath is fundamental to how the JVM finds classes. When using Maven or Gradle, these build tools manage the classpath. However, IntelliJ sometimes has its own internal view. Problems can arise if:

  • Your build tool hasn’t synchronized correctly with IntelliJ.
  • There are conflicting transitive dependencies.
  • The output directory for compiled test classes is excluded or misconfigured.

A quick way to check is to look at File > Project Structure > Modules > Paths and verify the “Compiler output” paths. ### JDK/SDK Mismatch or Configuration

Ensure that the Project SDK (File > Project Structure > Project) matches the SDK configured for your specific module (File > Project Structure > Modules). Inconsistencies can lead to compilation issues where test classes are either not compiled at all or compiled with an incompatible Java version, making them unreadable by the JVM during test execution.

Misconfigured Run/Debug Configurations

This is a critical area. When you right-click and run a test, IntelliJ creates a run configuration. Sometimes, these configurations become corrupted or are set up incorrectly. Check Run > Edit Configurations.... Ensure that:

  • The “Test kind” is correctly set (e.g., “Class,” “Method,” “Package,” “All in Package”).
  • The “Class” or “Package” field points to the exact test class or package you intend to run.
  • The “Use classpath of module” dropdown points to the correct module containing your tests.

A common mistake is selecting a module that doesn’t include the test sources in its classpath. Step-by-Step Solutions to Resolve the Error

When faced with “Class Not Found: Empty Test Suite in IntelliJ,” a structured troubleshooting approach is key. The following steps cover the most common fixes, guiding you through the process of restoring your test execution capabilities.

To resolve the “Class Not Found: Empty Test Suite in IntelliJ” error, begin by ensuring your project’s Maven or Gradle configuration is up-to-date and correctly imported, then verify that your test source roots are properly marked in IntelliJ’s project structure, and finally, check the specific run/debug configuration for the test to ensure it targets the correct module and test class.

  1. Verify and Re-import Dependencies:

    • For Maven projects, open your pom.xml. Ensure JUnit (or TestNG) dependencies are correctly declared, typically with <scope>test</scope>. After modifying, right-click the pom.xml and select Maven > Reload Project.
    • For Gradle projects, check your build.gradle file. Dependencies should be in testImplementation or testCompile. After changes, click the “Reload All Gradle Projects” button in the Gradle tool window.

    This step ensures that all necessary testing libraries are available on the project’s classpath.

  2. **Check Project Structure and Module Settings:**Go to File > Project Structure... (or Ctrl+Alt+Shift+S).

    • Under Project, confirm that the correct Project SDK is selected and configured.
    • Under Modules, select your module. Go to the Sources tab and ensure that your test source folders (e.g., src/test/java) are marked as “Test Sources Root” (green color). If not, right-click the folder and assign the correct type.
    • Still under Modules, navigate to the Paths tab. Verify that “Use module compile output path” is selected and that the “Test output path” points to a valid directory.
  3. **Invalidate Caches and Restart IntelliJ:**Sometimes, IntelliJ’s internal caches can become corrupted. Go to File > Invalidate Caches / Restart.... Select Question & Answer :

    I’m just starting the computer science program at my college, and I’m having some issues with IntelliJ. When I try to run unit tests, I get the message

    Process finished with exit code 1 Class not found: "edu.macalester.comp124.hw0.AreaTest"Empty test suite. 
    

    I also see a message entitled “No tests were found” on the left side of my screen. My test code is here:

    package edu.macalester.comp124.hw0; import org.junit.Test; import static org.junit.Assert.*; public class AreaTest { @Test public void testSquare() { assertEquals(Area.getSquareArea(3.0), 9.0, 0.001); } @Test public void testCircle() { assertEquals(Area.getCircleArea(3.0), 28.2743, 0.001); } } 
    

    And my project code is here:

    package edu.macalester.comp124.hw0; import java.lang.Math; public class Area { /** * Calculates the area of a square. * @param sideLength The length of the side of a square * @return The area */ public static double getSquareArea(double sideLength) { // Has been replaced by correct formula return sideLength * sideLength; } /** * Calculates the area of a circle. * @param radius The radius of the circle * @return The area */ public static double getCircleArea(double radius) { // Replaced by correct value return radius * 2 * Math.PI; } } 
    

    How can I get my tests to work? I’m using the most recent version of IntelliJ IDEA CE.

    Had the same message. I had to remove the Run/Debug configuration.

    In my case, I ran the unit test as a local test before. After that I moved my test to the androidTest package and tried to run it again. Android Studio remembered the last run configuration so it tried to run it again as a local unit test which produced the same error.

    After removing the config and running the test again it generated a new configuration and worked.

    enter image description here