Friday, 5 July 2013

Running tests Test running startedTest running failed: Unable to find instrumentation info for: ComponentInfo{ []/android.test.InstrumentationTestRunner} Empty test suite.

I have been trying to run tests using Intellij's Android Studio. So I started here and used the IDE to help me create everything I needed. Failed horribly. Then I followed this and kept receiving this HELPFUL message:

like a billion times!

 These are the things I have learnt:

  • Android/Studio use JUnit 3 so the constructor for your test suite MUST NOT have any parameters (aka don't let Studio create a constructor for you because it will add a parameter and JUnit will not be able to find your test suite):

  • Your test needs to be in:
    More info
  • The package of your test needs to be different from the package of the class you want to test, i.e: if the package for your activity is
    then the test should be in
  • Don't bother trying to run it from the IDE (don't believe this)
    • Start your emulator
    • Go to <yourProjectDir> (or where your gradlew is)
    • Run ./gradlew connectedInstrumentTest
    • The results can be found at: