使用 ANDROIDX_TEST_ORCHESTRATOR 时未发现测试 [英] No tests found when using ANDROIDX_TEST_ORCHESTRATOR

查看:41
本文介绍了使用 ANDROIDX_TEST_ORCHESTRATOR 时未发现测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 testOptions

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

然后我运行仪器测试

./gradlew connectedStudioDebugAndroidTest --stacktrace

我收到未找到测试的错误

I get error that tests are not found

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

当我在 testOptions

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

测试运行.

那么如何使用 ANDROIDX_TEST_ORCHESTRATOR 运行测试?

So how can I get tests to run with ANDROIDX_TEST_ORCHESTRATOR?

编辑

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

I made some progress: the androidTests run on my real device (API 28) but not any emulator (API 28). I'm on OSX btw.

推荐答案

这似乎是 ANDROIDX_TEST_ORCHESTRATOR 版本 1.2.0 及更早版本中的错误.

This seems to be a bug in ANDROIDX_TEST_ORCHESTRATOR version 1.2.0 and older.

我通过在 build.gradle 文件的 dependencies 中将版本升级到 1.3.0-rc01 使其工作.

I got it to work by bumping the version to 1.3.0-rc01 in the dependencies in the build.gradle file.

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

这篇关于使用 ANDROIDX_TEST_ORCHESTRATOR 时未发现测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆