13

I've currently set my TeamCity instance to run connectedCheck on all my Android-projects. This is fine, all tests run and everything is good. Except, connectedCheck runs all tests for all product flavors. I currently have a lot of flavors, so this is wasted work for my projects as I do not really have any different code in the flavors. Any idea how I can make connectedCheck only run for one flavor?

Kenneth
  • 3,957
  • 8
  • 39
  • 62
  • Have you found a workaround to this? I'm also interested in finding [some kind of separation](http://stackoverflow.com/questions/23046259/is-there-a-way-to-only-run-a-specific-set-of-tests-in-an-android-gradle-project). – Mendhak Apr 13 '14 at 17:59
  • No, I couldn't spend any more time investigating this issue. My current setup just runs 'connectedCheck'. I just checked the gradle build tasks. See my answer below. – Kenneth Apr 22 '14 at 06:35
  • I got an answer on [my question](http://stackoverflow.com/a/23065258/974369); it wasn't too painful but I use the separation of `@SmallTest` and `@MediumTest`. – Mendhak Apr 22 '14 at 08:14

5 Answers5

21

./gradlew connected[Flavor]DebugAndroidTest

ViliusK
  • 11,345
  • 4
  • 67
  • 71
  • What if i i have flaourA flavourB and flavourC and i just wanna test FlavourA and B? – Jono Jul 17 '19 at 06:17
  • @jonney, it should be ./gradlew connectedFlavorADebugAndroidTest connectedFlavorBDebugAndroidTest – ViliusK Jul 19 '19 at 14:30
12

./gradlew connectedBuildVariantAndroidTest

Example:

./gradlew connectedDevelopmentDebugAndroidTest

4

As vida said you can run ./gradlew tasks to check all possibilities to run gradle commands.

I'd like to suggest the following: ./gradlew tasks | grep connected. This filter all connectedAndroidTest variants that can be runned.

0

I see there is a new task since I checked this the last time, "connectedAndroidTestProductFalvor_buildvariant".

I haven't had time to check this task yet, but the description reads "Installs and runs the tests for build ProductFlavor_buildvariant on connected devices."

Will post a result when I've been able to test this.

Kenneth
  • 3,957
  • 8
  • 39
  • 62
0

and if you want to generate the apk for the android test :

./gradlew assemble[flavour]DebugAndroidTest
surga
  • 1,436
  • 21
  • 25