Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Android Junit tests from command line

I want to be able to run Junit tests from the command line, but when I run this command

java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore [test class name]

All I get back is

OK (0 tests)

Does it have something to do with it being an Android project? I've run that command before and haven't had much issue.

like image 750
ZacAttack Avatar asked Oct 22 '25 18:10

ZacAttack


1 Answers

I just managed to run JUnit tests from command line, but using an adb shell.

The command was

./adb shell am instrument -w com.dddforandroid.api/android.test.InstrumentationTestRunner

More details here.

like image 124
andreea.sandu Avatar answered Oct 24 '25 07:10

andreea.sandu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!