java.lang.Exception: No tests found matching Method using Intellij IDEA
Solution 1:
If you're using a theory testing framework like Junit's or Robolectric's, make sure to run the class containing the test you want, instead the test itself. Since these frameworks use the test methods as instance methods instead of static methods, any testing framework looking for a normal public static
test won't find anything.
Solution 2:
The same issue i got with Gradle (4.5+) + new Build Cache feature
Sometimes it's unable to find new test methods and throws exception (like you mentioned in topic)
Solution: clean .gradle
, build
and out
directories and try again ;)
Solution 3:
Well, after "playing" a bit with run configurations of each unit test I noticed that each Run Config has a Build
goal preset in the Before Launch
option (See pic below):
After changing Build
to Build Project
the tests run fine.