Why is the Android test runner reporting “Empty test suite”?

You need to provide default constructor for your test class, for example:

package nilzor.myapp.tests;

public class NilzorSomeTest extends ActivityUnitTestCase<ActivityYouWantToTest>{
    public NilzorSomeTest(){
        super(ActivityYouWantToTest.class);
    }

    @SmallTest
    public void testBlah(){
        assertEquals(1,1);
    }
}

about your other questions:

  1. No. My tests still run without any annotations, but I guess it’s a good practice to have them. It allows you to specify size of tests to run. See What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android? for more detail.

  2. Yes, you need “test” prefix. InteliJ gives “method never used” warning when there’s no “test” prefix, and skips that method during test run.

  3. Yes. I have my tests organized into subpackages and it seems to be working well.

Leave a Comment