综合测试和黄瓜测试

655*_*536 5 instrumentation android cucumber

我有一个项目,我正在运行Android的仪器测试AndroidJunitRunner.

我现在正在使用Cucumber添加UI自动化测试.如何保持使用扩展的跑步者的Cucumber测试以及使用MonitoringInstrumentation扩展"AndroidJunitRunner"的跑步者的其他测试测试?

build.gradle我以前有

    testInstrumentationRunner "com.packagename.packagename2.MockedTestRunner"
Run Code Online (Sandbox Code Playgroud)

我现在有:

    testApplicationId "com.packagename.packagename2.test"
    testInstrumentationRunner "com.packagename.packagename2.test.Instrumentation"
Run Code Online (Sandbox Code Playgroud)

我是否需要创建第二个模块来运行黄瓜测试?

Ami*_*rhf 2

要使用 Gradle 命令行工具启用 Android Test Orchestrator,请完成以下步骤:

android {
  defaultConfig {
   ...
   testInstrumentationRunner "androidx.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 'ANDROIDX_TEST_ORCHESTRATOR'
  }
}

dependencies {
  androidTestImplementation 'androidx.test:runner:1.1.0'
  androidTestUtil 'androidx.test:orchestrator:1.1.0'
}
Run Code Online (Sandbox Code Playgroud)
  1. 通过执行以下命令来运行 Android Test Orchestrator

    ./gradlew 连接检查

从 Android Studio
启用 Android Studio 3.0 及更高版本提供对 Android Test Orchestrator 的支持。要在 Android Studio 中启用 Android Test Orchestrator,请将“从 Gradle 启用”中显示的语句添加到应用程序的 build.gradle 文件中。