Ultimate 2018.1 Running single unit test method results in "Process finished with exit code 1 - Class not found - Empty test suite"



I'm trying to run a single unit test method inside of my multi-module Gradle project. I right-click on the method, select "Run...()' and the result is:


Process finished with exit code 1
Class not found: "com.....SomeTest"Empty test suite.


When I run the test from the terminal window no problem at all:


$ ./gradlew :SomeModule:test --tests com....SomeTest.someTestMethod


Similarly running the 'test' task from the Gradle tool window works as expected and all the tests run fine.

Invalidating caches and restarting does not help.

I have also just tried the 'Recompile... F9' option on the test class and got an error like below for every single import from within of my project (but not for imports from external libraries):


Error: java: /path/to/test/class/SomeTest package com.my.project.somepackage does not exist


What is going on?



Please share a sample project to reproduce the issue.


This is not a project that can be shared I'm afraid.

I was intending to trim it down and I can't recall the exact steps I followed, I didn't expect the initial cloning and importing to make any difference, but at the moment I have two *exact* same copies of this project and in one the test does not work just as described above and in the other it does work. Clearly something wrong with Idea metadata.

There is a difference in the run command for this same test. The project where the test works has the following entries for the classpath (amongst other jars and dependencies):


whereas the project where the test fails has the two last ones missing:


When I say exactly same copies I mean everything but the idea iml files. There are differences there and I guess this is something that I may share if you suspect this might be a problem and would like to have a look.


Try to delete .idea directory and reimport the project from Gradle.


So what I did was a similar thing to before. I copied the troublesome project, diffed - not a single difference, opened the original project and run the test - no joy, opened the copy and run the test - the test run successfully.

Deleting .idea and re-importing the project in the original copy "fixed" it.

This may work but I'm not very happy that I have to lose all project specific settings in order for Idea to work properly again.



I have encountered same problem after moving to IntelliJ 2018.1 Community edition recently.

There is nothing special about the project. I'm using Junit5 with Maven3

If I run whole integration test class (all tests) then everything works fine.

Tried to run it both by right click on test class -> Run... and by running test suite a.k.a @RunWith(JUnitPlatform.class)

But if I try to run specific test method by right click on @Test method -> Run... then get this "Empty test suite" error.

It is very annoying that every few times I have to re-import the project.

I'm sorry but it sounds like "restart your computer" solution.



Please report at https://youtrack.jetbrains.com/issues/IDEA with a sample project to reproduce.


After playing around with Jupiter and Vintage engines (JUnit5) I can confidentially say that for me it happens only with Jupiter engine.

I will upload sample project.

What does work:

1. Run suite (a.k.a @RunWith(JUnitPlatform.class))

2. Run Vintage test class (right click on class name - Run). All test methods annotated with @org.junit.Test

3. Run Vintage test method (annotated with @org.junit.Test annotation)

4. Run Jupiter test class (right click on class name - Run)

What fails:

Running test methods of Jupiter test class 

Opened issue https://youtrack.jetbrains.com/issue/IDEA-192507 


The issues was closed as a duplicate.

Seems like all similar JUnit5 issues are closed by IntelliJ  support team w/o providing any solid solution and reasoning why it keeps happening even in newest versions of IntelliJ.

Anyway, I managed to "fix" it in my project (can't explain how exactly) after messing around with project's modules. This is what solved my problem (for the record only)

After manually removing junit-platform-common module and having specifying one with suitable version (I'm using junit platform 1.2.0) I saw that IntelliJ added again common module but this time version 1.2.0 and also different hierarchy. Since then all my projects with JUnit5 started working as expected. Running individual Jupiter engine test method worked fine.

It even partially solved the double-clicking / right click problem (https://youtrack.jetbrains.com/issue/IDEA-183491).

Seems like there is some dependencies management issues 


IDEA-190323 provides the details, see the comments from Anna.


Please sign in to leave a comment.