3
votes

Get next info message:

Testing started at 12:26 PM ...

03/02 12:26:53: Launching 'All tests in app' on Xiaomi Redmi Note 8. Running tests

$ adb shell CLASSPATH=$(pm path androidx.test.services) app_process / androidx.test.services.shellexecutor.ShellMain am instrument -r -w -e targetInstrumentation com.mandarine.authenticator.tests/androidx.test.runner.AndroidJUnitRunner --no-window-animation -e package com.mandarine.authenticator.unitTests -e debug false androidx.test.orchestrator/androidx.test.orchestrator.AndroidTestOrchestrator

Started running tests

Test running failed: No test results

But when i deleted this option, tests run:

testOptions {
    execution 'ANDROID_TEST_ORCHESTRATOR'
}

UPD:

Updated dependencies ANDROIDX_TEST_ORCHESTRATOR , and get next error: Test running failed: Instrumentation run failed due to 'Process crashed.'

Get next error in Logcat:

2020-03-03 10:21:38.333 2869-2892/? E/AndroidTestOrchestrator: Fatal exception when setting up. java.lang.IllegalStateException: Permission requested but not granted! at androidx.test.orchestrator.AndroidTestOrchestrator.grantRuntimePermissions(AndroidTestOrchestrator.java:231) at androidx.test.orchestrator.AndroidTestOrchestrator.onStart(AndroidTestOrchestrator.java:201) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2154) 2020-03-03 10:21:38.346 2869-2892/? E/AndroidRuntime: FATAL EXCEPTION: Instr: androidx.test.orchestrator.AndroidTestOrchestrator Process: androidx.test.orchestrator, PID: 2869 java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.app.Instrumentation.getContext()' on a null object reference at androidx.test.orchestrator.listeners.OrchestrationXmlTestRunListener.createOutputResultStream(OrchestrationXmlTestRunListener.java:253) at androidx.test.orchestrator.listeners.OrchestrationXmlTestRunListener.generateDocument(OrchestrationXmlTestRunListener.java:191) at androidx.test.orchestrator.listeners.OrchestrationXmlTestRunListener.orchestrationRunFinished(OrchestrationXmlTestRunListener.java:178) at androidx.test.orchestrator.AndroidTestOrchestrator.finish(AndroidTestOrchestrator.java:443) at androidx.test.orchestrator.AndroidTestOrchestrator.onStart(AndroidTestOrchestrator.java:210) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2154)

2
as your using androidx (androidx.test.runner.AndroidJUnitRunner) please change 'ANDROID_TEST_ORCHESTRATOR' to 'ANDROIDX_TEST_ORCHESTRATOR' - user5607081
this solution doesn't work for me - Morozov
did you add this androidTestUtil 'androidx.test:orchestrator:1.2.0' along with the execution options ? - Lena Bru
@LenaBru updated this dependencies and use ANDROIDX_TEST_ORCHESTRATOR , and get next error: Test running failed: Instrumentation run failed due to 'Process crashed.' - Morozov
please look in the error log of the logcat and tell me what it says - Lena Bru

2 Answers

3
votes

Delete app level build.gradle file's line, Does the trick.

testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
}

Worked.

0
votes

The real problem here is testInstrumentationRunnerArguments clearPackageData: 'true'. It should work if you remove it.

This happens because there is a bug in Orchestrator (or Jacoco?): https://issuetracker.google.com/issues/72758547 and https://issuetracker.google.com/issues/123987001.

I'm using androidTestUtil 'androidx.test:orchestrator:1.3.0-beta01' and still happens. I'm also waiting for a fix.