Running Android Junit tests from command line

后端 未结 2 1664
不知归路
不知归路 2021-01-03 10:25

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 c         


        
相关标签:
2条回答
  • 2021-01-03 10:55

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

    The command was

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

    More details here.

    0 讨论(0)
  • 2021-01-03 10:59

    Template:

    adb shell am instrument -w <YOUR_PACKGE_NAME>.test/android.support.test.runner.AndroidJUnitRunner
    

    Example:

    adb shell am instrument -w com.example.android.testing.blueprint.flavor2.test/android.support.test.runner.AndroidJUnitRunner
    

    Details on Google's github page: Android Testing Blueprint

    0 讨论(0)
提交回复
热议问题