To complete the tale, I solved the last obstacle and the test now runs.
Lets start with the bottom line:
AndroidTestCase
requires JUnit3 tests. The annotation @Test
fails the test with ClassNotFound
for the org.junit.Test
class.
Once I commented out all @Test
annotations the test started to run.
One more guideline: test names should start with the prefix "test" for JUnit3
Strangely the JUnit4 annotation @BeforeClass
did not trigger a failure.
Conclusion:
JUnit4 test styles is only good for pure Java Unit tests. For Android Unit tests use JUnit3 style, since JUnit4 is backwards compatible it will compile fine.
Please note that this post refers only to Unit testing, I haven't got to the stage where I need to test the Android application itself with functional tests.