No tests found when using ANDROIDX_TEST_ORCHESTRATOR
Asked Answered
F

1

13

When I have ANDROIDX_TEST_ORCHESTRATOR in testOptions

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

and I run the instrumented test

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

and when I comment out ANDROIDX_TEST_ORCHESTRATOR in testOptions

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

the tests run.

So how can I get tests to run with ANDROIDX_TEST_ORCHESTRATOR?

edit

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

Feinberg answered 15/6, 2020 at 19:11 Comment(0)
U
6

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

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'
Uranus answered 16/6, 2020 at 1:10 Comment(3)
I have androidTestImplementation deps.testx.orchestrator should it be androidTestUtil?Feinberg
according to the docs yes. I'm not familiar with androidTestImplementation deps.testx.orchestrator so I can't say if that serves a differente purpose or not.Uranus
Your solution worked, but oddly when I switched back to 2.0 and androidTestImplementation, the tests still ran ... however, this is the first time the tests have run at all in the past couple of days, so checkmark.Feinberg

© 2022 - 2024 — McMap. All rights reserved.