Skip to content Skip to sidebar Skip to footer

Junit/espresso: "empty Test Suite"

Far too often in Android Studio I run into this problem: I can run the entire suite of UI Tests just fine, but cannot run a single file or a single test case. When I try, I will ge

Solution 1:

It's a hassle, but I have found a solution.

Go to Edit Configurations...

enter image description here

Add a new test configuration manually. Make sure to select Android Instrumented Tests

enter image description here

Type in a name for this configuration - probably just the name of the class.

enter image description here

Select the appropriate module from the drop-down list. Then select the "Class" option (assuming you want to run one file's worth of tests at a time)

enter image description here

Click the ... button and search for the specific class you want. Then hit OK to exit the Run Configuration screen.

Make sure your new configuration is selected and that it is showing the icon with an Android head. This means it is an Android Instrumented Test, which is necessary for Espresso. Otherwise it will try (and fail) to run it as a regular JUnit test.

Done! Now you should be able to run your tests.

Post a Comment for "Junit/espresso: "empty Test Suite""