I am banging my head against the wall here trying to figure out why IntelliJ/Android is reporting \"Empty test suite\". I have a small project with two IntelliJ Modules (\"
None of the other solutions worked for me, but I was able to get this working simply by uninstalling the existing app or test suite, then running the tests.
In Android studio with spock framework I've changed my gradle's version from 2.2.2 to 3.2.1 and all goes well.
I had this happen to me when I mistakenly marked a non mock class variable with the annotation @Mock
Removed the annotation and the tests ran successfully.
This happened with Junit 4.5 on Android Studio
Here are my debugging steps I go through when Android Studio all of a sudden decides to stop running / debugging tests (And boy does this happen embarassingly often!!):
I will add more fixes as I run into them!
In my case, I had my instrumented tests in androidTest/java/<package.name>/MyTestingClass
, but I had set my current build variant to "preproduction". And there's the point! As specified in Android Studio documentation:
By default, all tests run against the debug build type.
The message Class not found. Empty test suite.
kept appearing until I did this:
Add this line to my build.gradle:
android{
[...]
testBuildType "preproduction"
}
Then I executed the tests again and this time they run just perfect!!!
None of the above fixed it for me. What helped was following the instructions:
Create a test configuration
In Android Studio:
- Open Run menu -> Edit Configurations
- Add a new Android Tests configuration
- Choose a module
- Add a specific instrumentation runner:
android.support.test.runner.AndroidJUnitRunner
Run the newly created configuration.