Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Can';t仅针对特定文件夹启动测试_Android_Android Gradle Plugin_Android Espresso - Fatal编程技术网

Android Can';t仅针对特定文件夹启动测试

Android Can';t仅针对特定文件夹启动测试,android,android-gradle-plugin,android-espresso,Android,Android Gradle Plugin,Android Espresso,在我的android应用程序中,我做了很多浓缩咖啡测试。 它位于: /app/src/androidTest/kotlin/com/myproject/android/folder1/ 及 /app/src/androidTest/kotlin/com/myproject/android/folder2/ 要运行所有插入指令的测试,我使用以下方法: gradlew app:connectedAndroidTest gradlew app:connectedAndroidTest -P

在我的android应用程序中,我做了很多浓缩咖啡测试。 它位于:

/app/src/androidTest/kotlin/com/myproject/android/folder1/
及 /app/src/androidTest/kotlin/com/myproject/android/folder2/

要运行所有插入指令的测试,我使用以下方法:

gradlew app:connectedAndroidTest
    gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.myproject.android.activity.*

but I get error:

04:45:23 V/ddms: execute: returning

> Task :app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> Could not generate test report to '\app\build\reports\androidTests\connected'.
此处输出:

10:44:37 V/ddms: execute: returning

> Task :common:connectedAndroidTest

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 7m 43s
97 actionable tasks: 25 executed, 8 from cache, 64 up-to-date
很好。 但我只需要在
folder2
中开始测试。我用这个:

gradlew app:connectedAndroidTest
    gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.myproject.android.activity.*

but I get error:

04:45:23 V/ddms: execute: returning

> Task :app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> Could not generate test report to '\app\build\reports\androidTests\connected'.

在测试参数中使用包而不是类
gradlew应用程序:connectedAndroidTest-Pandroid.TestInstrumentationRunneArguments.package=com.myproject.android.packageName

运行命令“gradlew connectedAndroidTest”的输出是什么?日志显示“在7m 43s内成功构建”。仅当您传递参数时,它才会失败。gradlew app:connectedAndroidTest-Pandroid.testinstrumentationrunnearguments.package=com.company.myproject.android.activity.transitions-现在只运行文件夹“transitions”中的所有测试。美好的