Android espresso test script
Asked by Niral Bhavsar:

I am working on an Android project and also implementing CI/CD for the same. I have JUnit and Android Espresso with unitTest and androidTest packages.

I am able to perform unitTest through Bigbucket CI/CD with an example script but how i should perform it? Please suggest.

Using this script step 4 is getting failed

```
image: androidsdk/android-30
pipelines:
  default:
    - parallel:
        - step:
            name: Android Debug Application
            caches:
              - gradle
            script:
              - ./gradlew assembleDebug
            artifacts:
              - app/build/outputs/**
        - step:
            name: Lint
            caches:
              - gradle
            script:
              - ./gradlew lint
            artifacts:
              - app/build/reports/**
        - step:
            name: Unit Test
            caches:
              - gradle
            script:
              - ./gradlew :app:testProductionDebugUnitTest
            artifacts:
              - app/build/reports/**
        - step:
            name: UI Test
            caches:
              - gradle
            script:
              - ./gradlew :app:connectedProductionDebugAndroidTest
            artifacts:
              - app/build/reports/**
```


Answers:
author: Patrik S
body: Hello [@Niral Bhavsar](/t5/user/viewprofilepage/user-id/5025415) ,

Thank you for reaching out to Atlassian Community!

Could you please share with us the logs from the step that is failing?

Also, if you try running the same build locally in your machine, does the same error happens? If you are not sure how to run it locally in a docker container, please refer to the instructions in the following documentation :

* <https://support.atlassian.com/bitbucket-cloud/docs/debug-pipelines-locally-with-docker/>

Kind regards,

Patrik S

comments: author: Niral Bhavsar
body: Here is my Log file it says

\> com.android.builder.testing.api.DeviceException: No connected devices!

It is failed for Step 5 - UI Test

[Pileline Logs](https://www.dropbox.com/s/aym2ug2k3p1rptf/pipelineLog-%7B31ae40e6-de5c-4d64-98b6-0b9ae95b1860%7D.txt?dl=0)


author: Patrik S
body: Hello [@Niral Bhavsar](/t5/user/viewprofilepage/user-id/5025415) ,

The error you reported was most likely because there was no device started in the android emulator to run your UI tests.

The android emulator needs Hardware acceleration to properly work, and unfortunately, at this moment pipeline environment does not support Hardware acceleration. We already have a feature request to implement this functionality, which you can find in the link below:

* <https://jira.atlassian.com/browse/BCLOUD-21059>

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with [this policy](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) in mind.

Thank you, [@Niral Bhavsar](/t5/user/viewprofilepage/user-id/5025415) .

Kind regards,

Patrik


Tags: bitbucket-cloud

cloud