标签: android-test-orchestrator

Android 仪器测试中的“additional_test_output”?

运行 Android Instrumented Tests,gradle 任务:app:connectedDebugAndroidTest现在在成功测试运行后打印红色警告:

Feb 12, 2022 11:53:02 PM com.android.tools.utp.plugins.host.additionaltestoutput.AndroidAdditionalTestOutputPlugin deviceShellAndCheckSuccess
WARNING: Shell command failed (1): ls "/sdcard/Android/media/<APP_NAME>/additional_test_output"
ls: /sdcard/Android/media/<APP_NAME>/additional_test_output: No such file or directory

Feb 12, 2022 11:53:02 PM com.android.tools.utp.plugins.host.additionaltestoutput.AndroidAdditionalTestOutputPlugin afterAll
WARNING: Failed to retrieve additional test outputs from device.
com.android.ddmlib.SyncException: Remote object doesn't exist!
    at com.android.ddmlib.SyncService.pullFile(SyncService.java:341)
    ...
Run Code Online (Sandbox Code Playgroud)

确实模拟器没有这样的文件,但是之前测试并没有想到会创建它。

问:有办法解决这个警告吗?这是测试协调器错误吗?(我不打算破解测试来创建空文件。)

环境: MBP 上的 Android Studio、com.android.tools.build:gradle:7.1.1APIandroidx.test:orchestrator:1.4.1级别 26 - 32 的 Android 模拟器,有些带有 Google API,有些没有 Google API;也在 API 级别 31 的 Pixel 3 …

android android-test-orchestrator

13
推荐指数
1
解决办法
2908
查看次数

Android 测试编排器未找到测试

我正在使用 Kotlin 编程语言开发 Android 应用程序。我正在为我的应用程序编写仪器测试。我还使用测试协调器来运行我的仪器测试。但是安装测试编排器并修改Grandle文件后,我无法在Android Studio中运行测试。

我将以下配置添加到 app.grandle 文件中

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.memento"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
//        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testInstrumentationRunner "com.example.memento.MockTestRunner"
        // Cleared between tests.
        testInstrumentationRunnerArguments clearPackageData: 'true'
        testOptions {
            execution 'ANDROID_TEST_ORCHESTRATOR'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

有了这个

androidTestImplementation 'com.android.support.test:runner:1.1.1'
    androidTestUtil 'com.android.support.test:orchestrator:1.1.1'
Run Code Online (Sandbox Code Playgroud)

这是 MockTestRunner 类

导入 android.app.Application 导入 android.content.Context 导入 androidx.test.runner.AndroidJUnitRunner 导入 com.example.utils.MockApplicationController …

android kotlin instrumented-test android-test-orchestrator

6
推荐指数
0
解决办法
575
查看次数

使用 ANDROIDX_TEST_ORCHESTRATOR 时未发现测试

当我ANDROIDX_TEST_ORCHESTRATOR在testOptions

testOptions {
    unitTests.includeAndroidResources = true
    animationsDisabled = true
    execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
Run Code Online (Sandbox Code Playgroud)

我运行仪器测试

./gradlew connectedStudioDebugAndroidTest --stacktrace
Run Code Online (Sandbox Code Playgroud)

我收到未找到测试的错误

com.android.builder.testing.ConnectedDevice > No tests found.[emu1(AVD) - 9] FAILED 
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
Run Code Online (Sandbox Code Playgroud)

当我ANDROIDX_TEST_ORCHESTRATOR在testOptions

testOptions {
    unitTests.includeAndroidResources = true
    animationsDisabled = true
    // execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
Run Code Online (Sandbox Code Playgroud)

测试运行。

那么我怎样才能让测试运行ANDROIDX_TEST_ORCHESTRATOR呢?

编辑

我取得了一些进展:androidTests 在我的真实设备 …

android android-testing android-test-orchestrator

6
推荐指数
1
解决办法
841
查看次数

使用 Orchestrator 时在 android 中使用 Jacoco 进行代码覆盖

我正在尝试从需要与 Android Test Orchestrator 一起运行的测试套件中获取覆盖率报告。

有一个固定问题引用了另一个固定问题。

按照他们的建议,我添加了

testInstrumentationRunnerArguments coverageFilePath: '/data/local/tmp/codeCoverage'
Run Code Online (Sandbox Code Playgroud)

但我仍然得到

 java.io.IOException: No coverage data to process in directories [[buildDr]/outputs/code_coverage/stageTestDebugAndroidTest/connected]
Run Code Online (Sandbox Code Playgroud)

我认为它可能与测试发行说明存档页面中的这一行有关

如果“coverage”和“coverageFilePath”参数都被传递,则仅启用协调器覆盖处理。

我试过添加

testInstrumentationRunnerArguments coverage: 'true'
Run Code Online (Sandbox Code Playgroud)

它没有什么区别,我找不到任何关于实际应该传递什么的信息。

你知道我缺少什么吗?

一个工作示例的链接也非常好。

android android-testing android-espresso androidjunitrunner android-test-orchestrator

6
推荐指数
0
解决办法
164
查看次数

启用 ANDROIDX_TEST_ORCHESTRATOR(1.4.0) 时未找到测试

我已阅读相关问题

但是,我正在使用'androidx.test:orchestrator:1.4.0'1.2.0 以下的版本,它不应该有错误。

我的情况是,我会收到错误:com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.[GM1910 - 11] FAILED如果我启用:

    testOptions {
        execution 'ANDROIDX_TEST_ORCHESTRATOR'
    }
Run Code Online (Sandbox Code Playgroud)

我已经完成了前缀操作:

    testOptions {
        execution 'ANDROIDX_TEST_ORCHESTRATOR'
    }
Run Code Online (Sandbox Code Playgroud)

android android-testing android-test-orchestrator

6
推荐指数
0
解决办法
532
查看次数