How to retrieve test results when using “adb shell am instrument”

前端 未结 3 401
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 10:30

I\'m executing some tests in my Android device by using the following command:

adb shell am instrument -w package.name/android.test.runner.AndroidJU

3条回答
  •  猫巷女王i
    2020-12-30 10:47

    I had a similar problem (I wanted to have xml test reports for my Jenkins when it runs instrumentation tests on a device). I solved it by implementing the "android-xml-run-listener" (https://github.com/schroepf/TestLab/tree/master/android).

    To use it simply add:

    androidTestCompile 'de.schroepf:android-xml-run-listener:0.1.3'
    

    to your build.gradle (note the androidTest prefix - this will not add code to your production app!).

    To use it, add:

    -e listener de.schroepf.androidxmlrunlistener.XmlRunListener
    

    to your am instrument command.

    And to retrieve the XML report file, use:

    adb pull /storage/emulated/0/Android/data//files/report.xml
    

提交回复
热议问题