bitrise-steplib / steps-virtual-device-testing-for-android

MIT License
22 stars 23 forks source link

clearPackageData flag gets ignored #38

Closed sergejsha closed 5 years ago

sergejsha commented 5 years ago

It relates to #29

When running instrumentation tests, I need to set clearPackageData true flag as Android documentation says (search for -e clearPackageData true).

I tried to put the flag into the following step

    - virtual-device-testing-for-android:
        inputs:
        - test_devices: Nexus6,25,de,portrait
        - inst_use_orchestrator: 'true'
        - test_timeout: '100'
        - test_type: instrumentation

like this (inputs: are omitted for sake of simplicity)

    - virtual-device-testing-for-android:
        environment-variables:
           clearPackageData: true

like this

    - virtual-device-testing-for-android:
        environment-variables:
           clearPackageData: 'true'

like this

    - virtual-device-testing-for-android:
        environment-variables:
        - clearPackageData: true

and like this

    - virtual-device-testing-for-android:
        environment-variables:
        - clearPackageData: 'true'

In all the cases tests have failed because the flag has not been actually applied.

Is this flag supported and if yes, what would be the correct syntax to provide it to the tests?

tir38 commented 5 years ago

I just used the UI editor:

screen shot 2019-02-22 at 6 03 42 pm

Which resulting in our bitrise.yml updating to:

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

You can see that it got set when you run the workflow:

Configs:
- ApkPath: /bitrise/deploy/app-debug.apk
- TestTimeout: 900
- DirectoriesToPull: 
- EnvironmentVariables: clearPackageData=true
- TestDevices:
---
Model     API Level   Locale     Orientation   
Nexus5X   24          portrait   en            
Nexus5X   25          portrait   en            
Nexus5X   26          portrait   en            
Pixel2    27          portrait   en            
---
- AppPackageID: 
- TestType: instrumentation
- TestApkPath: /bitrise/deploy/app-debug-androidTest.apk
- InstTestPackageID: 
- InstTestRunnerClass: 
- InstTestTargets: 
- UseOrchestrator: true

All of our tests are now passing.

BirmacherAkos commented 5 years ago

Hi!

Thanks @tir38 for the solution.

@beworker could you please try to pass the env to the step like @tir38 did?

BirmacherAkos commented 5 years ago

Hi!

I will close this issue as @tir38 provide the solution for it in https://github.com/bitrise-steplib/steps-virtual-device-testing-for-android/issues/38#issuecomment-466591584 . If you still have the issue please let us know.

Happy Building! 🚀

cpeppas commented 4 years ago

I had the same issue "clearPackageData flag been ignored". So then I used the envVar workaround mentioned above. That created a side effect. I was getting this error message randomly in different tests

Test failed to run to completion. Reason: 'Test run failed to complete. Expected 69 tests, received 11'. Check device logcat for details

Therefore I had to increase the timeout from 900 to 3600 which is another workaround to our initial problem.

Is there any other way of fixing this? @BirmacherAkos Can we re-open this ?

bitce commented 4 years ago

Hi @cpeppas!

Sorry to hear about this, can you please create a detailed report either in a new thread, here, or contact us about it directly?