RED_
RED_

Reputation: 3007

Integrating Android project with CircleCi, only test against one build variant with connectedAndroidTest command?

I'm battling against CircleCi at the moment, so many issues as I am new to it. Right now my app takes 20 minutes to build, because it's builds every productFlavour we have. In my circle.yml file I have the following command:

- ./gradlew --stacktrace connectedAndroidTest:
    timeout: 1200

The full circle.yml file starts the emulator and does a clean build of one of our productFlavours, called test. I can easily ensure only this productFlavour is built by running the following command:

 - ./gradlew clean assembleTestDebug -PdisablePreDex

This takes about 1 minute to build. My issue is now with the connectedAndroidTest command which then goes on to build all of our build variants with all build types (release and debug), then runs our test against them, this is very time consuming. Hence why our build times take 20 minutes.

Is there a way I can tell the connectedAndroidTest command in my circle.yml file to only run against TestDebug?

I tried adding the build variant to the end (connectedAndroidTestTestDebug) but this caused the following exception on CircleCi:

'connectedAndroidTestTestDebug' not found in root project 'my_project'.

Would appreciate any advice on the matter, from my experience, CircleCi has been a big pain to set up, I'm in contact with their support staff but they are in different timezones which is not ideal so progress in slow. I'm hoping someone who has set up an Android project on CircleCi with unit tests has figured out a way to only run them against one productFlavour/Build variant.

Thanks in advance for any advice!

Upvotes: 1

Views: 1023

Answers (1)

dweebo
dweebo

Reputation: 3272

Running a connectedAndroidTest with a build variant works for me on CircleCi.

For example I'm running

- /gradlew connectedStagingMockDebugAndroidTest

Are you sure you've got the right task? Check using

./gradlew tasks | grep connected

Upvotes: 2

Related Questions