No tests found when using ANDROIDX_TEST_ORCHESTRATOR

1.8k views Asked by At

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.

1

There are 1 answers

3
bruno_eiterer On BEST ANSWER

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'