android / android/android-test

androidx.test:orchestrator in test-only module ('com.android.test')

Open
#767 15 comments 6 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### Description
We are struggling to use the test orchestrator in our new test only module. We had it working fine when the tests were located in the app module.

One observation is that when working within a test-only module, dependencies are brought in slightly differently

Test only
```
implementation "androidx.test:runner:$androidTestRunnerVersion"
implementation "androidx.test:rules:$androidTestRulesVersion"
implementation "androidx.test.ext:truth:$androidTestTruthExtensionsVersion"
```

Normal app module
```
androidTestimplementation "androidx.test:runner:$androidTestRunnerVersion"
androidTestimplementation "androidx.test:rules:$androidTestRulesVersion"
androidTestimplementation "androidx.test.ext:truth:$androidTestTruthExtensionsVersion"
```

As you can see, the *androidTest* element is omitted. Test orchestrator is brought in using androidTestUtil.. is there an equivalent syntax for test-only modules? Is it possible that a test-only module ignores the androidTestUtil option?

` androidTestUtil 'androidx.test:orchestrator:1.3.0'`

### Steps to Reproduce
Create a test-only module using 'com.android.test' and attempt to use test orchestrator.
### Expected Results
Test orchestrator works as normal
### Actual Results
Test orchestrator isn't leveraged.
### AndroidX Test and Android OS Versions
'androidx.test:orchestrator:1.3.0' - Android 10/11/9
### Link to a public git repo demonstrating the problem:
https://github.com/asavill/test-orchestrator-in-test-only-module-issue

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction repository and inspect how the com.android.test module configures androidTestUtil and the androidx.test:orchestrator dependency. Verify whether the test orchestrator is installed and used for the test-only module; done means the reproduced tests run through the orchestrator as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.