在我的Android应用中,我进行了许多Espresso的测试。 它位于:
/app/src/androidTest/kotlin/com/myproject/android/folder1/
和 / app / src / androidTest / kotlin / com / myproject / android / folder2 /
要运行所有检测的测试,我使用以下方法:
gradlew app:connectedAndroidTest
此处输出:
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 -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'.
答案 0 :(得分:1)
在测试参数中使用包而不是类 gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.package = com.myproject.android.packageName