Fed*_*lia 1 java testing android android-studio
我正在尝试执行测试套件,但我的研究需要在每次测试之前让应用程序处于清除状态。使用 Gradle 的 connectedCheck 应用程序只是在每次测试之前恢复,我使用 Orchestrator 将 clear 参数设置为 true 以便在测试后擦除数据,但如果我同时执行包中的所有测试,它表明该应用程序并没有真正在执行之间被清除。
你对我为什么可以在 android studio 或命令行上完成这个有什么建议吗?
我也尝试通过
更新
显然,我发现了问题所在
testInstrumentationRunnerArguments clearPackageData: 'true',我已将协调器版本从 更新1.0.1为1.0.2,现在可以正常工作,在每次测试运行之前清除应用程序数据。
我设法通过更新 Orchestrator 版本来解决我的问题,如下所示:
构建.gradle
defaultConfig {
...
testInstrumentationRunner = 'android.support.test.runner.AndroidJUnitRunner'
// 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'
}
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
}
dependencies {
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
}
Run Code Online (Sandbox Code Playgroud)
问题出在以前版本的 Orchestrator 上1.0.1,不知道为什么。
| 归档时间: |
|
| 查看次数: |
1237 次 |
| 最近记录: |