# Virtual Device testing for Android step doesn't work properly with Orchestrator

**URL:** https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837
**Category:** Tooling Issues
**Created:** [May 3, 2020, 8:04pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837 "2020-05-03T20:04:36Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![javier.marsicano](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@javier.marsicano](https://discuss.bitrise.io/u/javier.marsicano)
#### Post date: [May 3, 2020, 8:04pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/1 "2020-05-03T20:04:36Z")

</div>

Hi,

I am running android UI Tests with Espresso. I am using Android Test Orchestrator and have set clear app data between tests option in my gradle build file, however Bitrise doesn’t clear app data between tests.  
When I run my tests locally via the Connect Android Test gradle task then data is cleared between tests and all tests pass, but in CI one of them fails because it preserves the state of previous test case.  
[Here’s the link to one of the failing builds](https://app.bitrise.io/build/400d9b0f2f3d0c25#?tab=log) (for more info go to Tests reports)

The following gradle configuration makes the Android Test Orchestrator run its “pm clear” command after each test invocation. This command ensures that the app’s state is completely cleared between tests. But it seems clearPackageData flag is being ignored

```
android {
    defaultConfig {
            ...
            testInstrumentationRunnerArguments clearPackageData: 'true'
        }

        testOptions {
            execution 'ANDROIDX_TEST_ORCHESTRATOR'
        }
 }
```

---

<div class="post-metadata">

### Author: ![koral](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/koral/32/357_2.png) [@koral](https://discuss.bitrise.io/u/koral)
#### Post date: [May 3, 2020, 10:19pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/2 "2020-05-03T22:19:18Z")

</div>

Is `Use orchestrator` step input set to true?

---

<div class="post-metadata">

### Author: ![javier.marsicano](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@javier.marsicano](https://discuss.bitrise.io/u/javier.marsicano)
#### Post date: [May 5, 2020, 6:44pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/3 "2020-05-05T18:44:13Z")

</div>

Yes @koral, I’ve tried with both `true` and `false` just in case. But none worked.

---

<div class="post-metadata">

### Author: ![javier.marsicano](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@javier.marsicano](https://discuss.bitrise.io/u/javier.marsicano)
#### Post date: [May 6, 2020, 8:24pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/4 "2020-05-06T20:24:08Z")

</div>

@koral, do you have any update?

---

<div class="post-metadata">

### Author: ![koral](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/koral/32/357_2.png) [@koral](https://discuss.bitrise.io/u/koral)
#### Post date: [May 7, 2020, 12:25pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/5 "2020-05-07T12:25:43Z")

</div>

Sorry but I’m not a Bitrise employee thus I don’t have access to logs.  
Having this public info only I don’t have any more ideas.

---

<div class="post-metadata">

### Author: ![javier.marsicano](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@javier.marsicano](https://discuss.bitrise.io/u/javier.marsicano)
#### Post date: [May 7, 2020, 1:52pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/6 "2020-05-07T13:52:57Z")

</div>

Maybe @tamaspapik or @fehersanyi-bitrise know something about it

---

<div class="post-metadata">

### Author: ![bitce](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/bitce/32/1639_2.png) [@bitce](https://discuss.bitrise.io/u/bitce)
#### Post date: [May 13, 2020, 8:19am UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/7 "2020-05-13T08:19:53Z")

</div>

Hi @javier.marsicano!

Sorry for the huge delay. For future reference, we can be more promptly reached on-site on our direct support channels.

As for this issue, our Tooling team took a brief look but we’ve found the latest build to pass. Can you please advise what changed, if it’s solved or if you just changed your approach?

---

<div class="post-metadata">

### Author: ![javier.marsicano](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@javier.marsicano](https://discuss.bitrise.io/u/javier.marsicano)
#### Post date: [May 13, 2020, 2:36pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/8 "2020-05-13T14:36:18Z")

</div>

Hi Bence @bitce. Latest build is successful because it is a differen wokflow with different steps and params. This issue is still happening

---

<div class="post-metadata">

### Author: ![laszlo.pusok](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@laszlo.pusok](https://discuss.bitrise.io/u/laszlo.pusok)
#### Post date: [May 14, 2020, 4:00pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/9 "2020-05-14T16:00:14Z")

</div>

Hello @javier.marsicano,  
I believe this to be the same issue as described here: [https://github.com/bitrise-steplib/steps-virtual-device-testing-for-android/issues/38](https://github.com/bitrise-steplib/steps-virtual-device-testing-for-android/issues/38)

So you need to set this option as an environment which is then passed from the test runner:

```auto
 - virtual-device-testing-for-android:
        inputs:
        - test_devices: "$INSTRUMENTATION_DEVICE_LIST"
        - inst_use_orchestrator: 'true'
        - environment_variables: clearPackageData=true
        - test_type: instrumentation

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/d901cf2aad020f2dd11918afc89ec2089bb87b35.png) [@system](https://discuss.bitrise.io/u/system)
#### Post date: [June 13, 2020, 4:00pm UTC](https://discuss.bitrise.io/t/virtual-device-testing-for-android-step-doesnt-work-properly-with-orchestrator/12837/10 "2020-06-13T16:00:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
