如何使用Gradle Android运行单个检测测试 [英] How can I run a single instrumentation test with Gradle Android
本文介绍了如何使用Gradle Android运行单个检测测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用此行运行测试...但这会启动所有测试:
I'm trying to run the tests with this line... but this launches all tests:
./gradlew -DconnectedAndroidTest.single=LandingActivityTests connectedAndroidTest
如何启动单个测试?
推荐答案
您可以通过两个步骤运行单个android测试:
you can run the single android test in two steps:
-
./gradlew installDebugAndroidTest
-
adb shell am instrument -w -e class com.example.MyInstrumentationTest#testFoo com.example.test/android.support.test.runner.AndroidJUnitRunner
https://developer.android.com/tools/testing/testing_otheride.html
./gradlew installDebugAndroidTest
adb shell am instrument -w -e class com.example.MyInstrumentationTest#testFoo com.example.test/android.support.test.runner.AndroidJUnitRunner
https://developer.android.com/tools/testing/testing_otheride.html
这篇关于如何使用Gradle Android运行单个检测测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文