无法仅针对特定文件夹启动测试

Can't start tests only for specific folder

在我的 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'.

在测试参数中使用包而不是 class gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=com.myproject.android.packageName