显然,经济放缓与包括
Android Test Orchestrator
,这是我不需要的(即使我在需要android上下文的设备上运行测试)。从我现有的文档中不清楚这些测试不需要编排器。
我把下面几行从
build.gradle
,我通过android studio的总执行时间下降到大约15秒:
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
...
execution 'ANDROID_TEST_ORCHESTRATOR'
...
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
所以这是新的
build.gradle公司
在大约15秒内执行测试:
android {
dexOptions {
preDexLibraries true
}
compileSdkVersion this.ext.compileSdkVersion
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 93
versionName "2.3.8"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
testOptions {
unitTests.includeAndroidResources true
}
...
}
...
dependencies {
...
// Unit tests
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
我想也许
testInstrumentationRunnerArguments clearPackageData: 'true'
是导致清除包数据的执行时间增加的主要原因,但仅删除该行并不会更改测试的总执行时间-我必须完全删除Orchestrator依赖项。
以下是GitHub上删除Orchestrator的提交:
https://github.com/OneBusAway/onebusaway-android/commit/a1657c443258ac49b1be83a75399cf2ced71080e