有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java使用Gradle运行特定于Android的检测测试

我需要从控制台用gradle执行某些Android测试用例(类或方法)。 它位于src/安卓Test/java/com/example/CertainTest。java

Android Studio通过复杂的adb shell am instrument实现了这一点

是否可以只通过Gradle调用特定的Android测试

我读过关于How to run only one test class on gradleTest from the Command Line的书,但这是一种非常复杂的方式

以下是Android Studio启动特定测试类的方式:

Launching Tests
$ adb push /.../app/build/outputs/apk/app-debug.apk /data/local/tmp/com.example.andrii.espressotutorial
$ adb shell pm install -r "/data/local/tmp/com.example.andrii.espressotutorial"
    pkg: /data/local/tmp/com.example.andrii.espressotutorial
Success
$ adb push /.../app/build/outputs/apk/app-debug-安卓Test.apk /data/local/tmp/com.example.andrii.espressotutorial.test
$ adb shell pm install -r "/data/local/tmp/com.example.andrii.espressotutorial.test"
    pkg: /data/local/tmp/com.example.andrii.espressotutorial.test
Success
Running tests
$ adb shell am instrument -w -r   -e debug false -e class com.example.andrii.espressotutorial.ExampleInstrumentedTest2 com.example.andrii.espressotutorial.test/安卓.support.test.runner.AndroidJUnitRunner
Client not ready yet..
Started running tests
Tests ran to completion.

共 (0) 个答案