Instrumentation did not complete failure when no tests are scheduled to run
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- android, java
- Domain
- mobile, testing-qa
Research direction
Reproduce the issue with one tablet and one phone emulator using the CustomFilter instrumentation filter, then inspect app/build/outputs/androidTest-results/test-results.log for the zero-test device. Trace how the connectedDebugAndroidTest task handles an instrumentation run with zero scheduled tests; done means the build succeeds when other devices complete their tests and one device schedules none.
Written by the indexing model from the issue text.
Description
Description
I have stumbled upon an issue where, if my instrumentation test filter is not able to run any tests, gradle build fails. Is there a way to avoid this ?
I have a test suite consisting of tablet and phone tests, and during runtime I am doing custom filtering based on the characteristic of device under test using CustomFilter API's. So, I have device pool consisting of a phone and tablet device. And I have having a class level annotation that specify tests to only target the tablet devices. As expected, all the tests run on tablet device. Since, there were no tests scheduled for the phone device. Even after all the test finished successfully, the build failed with the following error:
> Task :app:connectedDebugAndroidTest
Starting 0 tests on Pixel_6_API_34(AVD) - 14
Finished 0 tests on Pixel_6_API_34(AVD) - 14
> Task :app:connectedDebugAndroidTest
Starting 4 tests on Pixel_Tablet_API_34(AVD) - 14
Pixel_Tablet_API_34(AVD) - 14 Tests 1/4 completed. (0 skipped) (0 failed)
Pixel_Tablet_API_34(AVD) - 14 Tests 2/4 completed. (0 skipped) (0 failed)
Pixel_Tablet_API_34(AVD) - 14 Tests 3/4 completed. (0 skipped) (0 failed)
Finished 4 tests on Pixel_Tablet_API_34(AVD) - 14
> Task :app:connectedDebugAndroidTest
Instrumentation did not complete:
Instrumentation code: 0
Instrumentation result bundle:
> Task :app:connectedDebugAndroidTest FAILED
INSTRUMENTATION_RESULT: stream=
Time: 0
OK (0 tests)
INSTRUMENTATION_CODE: 0
this is the test-results.log file generated under app/build/outputs/androidTest-results dir for Pixel_6 device. I suspect instrumentation code need to be -1 for instrumentation to succeed.
<?xml version='1.0' encoding='UTF-8' ?>
<testsuite tests="0" failures="0" errors="0" skipped="0" time="0.61" timestamp="2024-08-12T14:46:15" hostname="localhost">
<properties>
<property name="device" value="Pixel_6_API_34(AVD) - 14" />
<property name="project" value=":app" />
</properties>
<system-err>Instrumentation did not complete:
Instrumentation code: 0
Instrumentation result bundle:
</system-err>
</testsuite>
xml report seems to contain system-err tag generated for the Pixel_6 device.
Steps to Reproduce
Spin up an emultor with tablet resolution(landscape) and other one with phone resolution(portrait)
Run test as usually and specify className as instumentation filter args.
Expected Results
The gradle build should succeed as it run tests on the desired device factor, skipping tests only on the non-desired device.
Actual Results
even though the test run succeed, the gradle build failed
AndroidX Test and Android OS Versions
AGP - 8.5.1
Espresso - 3.6.1
androidXTestCore - 1.6.1
androidXTestJUnit - 1.2.1
androidXTestRules - 1.6.1
androidXTestRunner - 1.6.1
androidXTestOrchestrator - 1.5.0
Link to a public git repo demonstrating the problem:
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/android-test
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
android/android-test#681 · 2 comments · 1 reaction ·
-
ξεκσνδξδ Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
android/android-test#2499 ·
-
ησξξσ Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
android/android-test#2498 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
android/android-test#2473 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
android/android-test#2461 · 6 comments · 4 reactions ·
All issues in android/android-test
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100