来自the docs
新功能:Orchestrator的测试测试 Android Test Orchestrator独立运行每个应用程序的测试测试,这有几个好处,但也有一个缺点:
优势
无共享状态:每个测试都在自己的Instrumentation实例中运行, 所以共享状态不会在测试中累积。
孤立的崩溃:如果测试崩溃,它只会自行消失 仪表实例,所以套件中的其他测试仍然存在 运行
缺点
更长的运行时间:每个测试都运行自己的Instrumentation实例 意味着测试过程总体上需要稍长一些。该 增加的运行时间可能会影响您的配额使用或计费时间 可能会导致你点击设备'超时限制。
现在它建议在本地运行新的orchestrator以确保它正常工作。所以我在将testOptions添加到我的模块的build.gradle文件后运行它:
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
}
与gradle依赖关系:
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
但在执行./gradlew connectedCheck
我尝试插入物理设备并同时运行模拟器api 26。所以我现在有两个设备连接到adb。然后执行./gradlew connectedCheck。我在控制台终端中看到以下输出:
#./gradlew connectedCheck
Parallel execution with configuration on demand is an incubating feature.
> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_495ocpxnm4a4fvowoj4qizq7q.run(/Users/me/Development/QA/android/MyApp/app/build.gradle:303)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
[newrelic.info] Android Gradle plugin version 3.+ detected. Using transform API
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
> Task :app:processLabsDebugGoogleServices
Parsing json file: /Users/me/Development/QA/android/Myapp/app/google-services.json
Starting 39 tests on Nexus_6P_API_26_oreo_xxhdpi(AVD) - 8.0.0
Starting 39 tests on SM-G610F - 7.0
<====---------> 33% EXECUTING [4m 40s]
它正在两台设备上运行测试。这是orchestrator的作用吗?
协调者的目的是什么?
答案 0 :(得分:1)
Android Test Orchestrator确保您的每个测试都在隔离的环境中运行。这意味着先前测试的结果不太可能影响未来测试的结果(由于共享状态)。
Android开发者博客和Read more上的