# Environment Variables are not getting passed to virtual device test lab

**URL:** <https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447>\
**Category:** Tooling Issues\
**Tags:** android\
**Created:** [December 6, 2017, 3:35pm UTC](https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447 "2017-12-06T15:35:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![geoff.powell](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@geoff.powell](https://discuss.bitrise.io/u/geoff.powell)\
**Post date:** [December 6, 2017, 3:35pm UTC](https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447/1 "2017-12-06T15:35:25Z")

</div>

I am trying to pass environment variables to your virtual device testing for android step.  
[https://github.com/bitrise-steplib/steps-virtual-device-testing-for-android](https://github.com/bitrise-steplib/steps-virtual-device-testing-for-android).

I know its in beta but you suggest options that don’t work. I have tried using the suggested values.

```auto
coverage=true
coverageFile="/sdcard/coverage.ec"

```

A coverage file is never created and it looks like it isn’t respecting the variables. I have tried setting the same vars with gcloud command line to run through firebase test lab and that is working.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [December 7, 2017, 10:15am UTC](https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447/2 "2017-12-07T10:15:33Z")

</div>

Hi @geoffpowell-vividsea,

> [@geoffpowell-vividsea](#):
>
> I have tried setting the same vars with gcloud command line to run through firebase test lab and that is working.

Can you please share the command you tried?

In general you have to enable Writing to SD Card to make code coverage reporting work with Firebase Test Lab, see: [How to get code coverage reports from google Firebase for Android Espresso tests - Stack Overflow](https://stackoverflow.com/a/41687205/974381)

Also, don’t forget to set the **Directories to pull** option of the step to the sdcard (e.g. `/sdcard` or `/sdcard/tempDir1` - as you can see in the description of this input).

If you’d have any questions just let us know! 🙂

---

<div class="post-metadata">

**Author:** ![geoff.powell](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@geoff.powell](https://discuss.bitrise.io/u/geoff.powell)\
**Post date:** [December 7, 2017, 2:31pm UTC](https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447/3 "2017-12-07T14:31:01Z")

</div>

So we have a script that runs gcloud command. It is running this successfully:

```auto
gcloud firebase test android run --app=../app-uitest-debug.apk, --test=../app-uitest-debug-androidTest.apk --device model=Nexus5X,version=23,locale=en,orientation=portrait --type=instrumentation --environment-variables suite="integration",coverage=true,coverageFile="/sdcard/coverage.ec" --directories-to-pull=/sdcard --results-dir=build-123/

```

Our test apk and app apk already have `WRITE_EXTERNAL` permissions and the `testCoverageEnabled` flag in our gradle config for debug builds.

We also have the Directories to Pull set because it is pulling our other test files just not the code coverage file we expect to be there.

Here is what we have set:

 ![13 AM](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/f/f0026f806cfc54c6956f39de93d49f0c6dfd75a7.png)

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [December 11, 2017, 8:55am UTC](https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447/4 "2017-12-11T08:55:38Z")

</div>

@geoffpowell-vividsea can you please copy paste the related build’s [Bitrise.io](http://Bitrise.io) URL here? We’ll look into it ASAP!

---

<div class="post-metadata">

**Author:** ![geoff.powell](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@geoff.powell](https://discuss.bitrise.io/u/geoff.powell)\
**Post date:** [December 11, 2017, 11:02pm UTC](https://discuss.bitrise.io/t/environment-variables-are-not-getting-passed-to-virtual-device-test-lab/3447/5 "2017-12-11T23:02:04Z")

</div>

Here is the build that is not working. [Bitrise - Mobile Continuous Integration and Delivery - iOS & Android Build Automation](https://www.bitrise.io/build/004dff5784e6cdcd)

 ![47 PM](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/f/f9fc2a9ad4549b638dc58a6f5129220e19c609f8.png)

I highlighted my variables that it makes it seem like its passing but the instrumentation test don’t run correctly.
