Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InitializationError for AndroidJunit4

Tags:

android

junit4

I have a single, simple unit test in my Android app module:

/src/test/java/org.acme.test/SimpleTest.java

When I run:

./gradlew clean testDebug --tests='*.SimpleTest'

I get this exception:

java.lang.Exception: Custom runner class AndroidJUnit4 should have a public constructor with signature AndroidJUnit4(Class testClass)

Why does it think 'AndroidJUnit4' is a custom runner class, when it's a final class?

like image 248
Andy H. Avatar asked Sep 24 '15 14:09

Andy H.


1 Answers

You might have the test class in test directory instead of androidTest.

like image 93
Aashwin M Avatar answered Sep 24 '22 00:09

Aashwin M