首页 > 解决方案 > 使用 ANDROIDX_TEST_ORCHESTRATOR 时未找到测试

问题描述

当我ANDROIDX_TEST_ORCHESTRATORtestOptions

testOptions {
    unitTests.includeAndroidResources = true
    animationsDisabled = true
    execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

我运行仪器测试

./gradlew connectedStudioDebugAndroidTest --stacktrace

我收到未找到测试的错误

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).

当我ANDROIDX_TEST_ORCHESTRATORtestOptions

testOptions {
    unitTests.includeAndroidResources = true
    animationsDisabled = true
    // execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

测试运行。

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

编辑

我取得了一些进展:androidTests 在我的真实设备(API 28)上运行,但不是任何模拟器(API 28)。我在 OSX 顺便说一句。

标签: androidandroid-testingandroid-test-orchestrator

解决方案


这似乎是ANDROIDX_TEST_ORCHESTRATOR版本1.2.0和旧版本中的错误。

我通过将版本添加到文件1.3.0-rc01中来让它工作。dependenciesbuild.gradle

androidTestUtil 'androidx.test:orchestrator:1.3.0-rc01'

推荐阅读