Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android gradle test only one flavor

Tags:

android

gradle

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?

like image 604
Kenneth Avatar asked Feb 21 '14 07:02

Kenneth


People also ask

How do I run a single test in gradle?

single system property can be used to specify a single test. You can do gradle -Dtest. single=ClassUnderTestTest test if you want to test single class or use regexp like gradle -Dtest. single=ClassName*Test test you can find more examples of filtering classes for tests under this link.

What is assembleAndroidTest?

assembleAndroidTest is the gradle command to build the second test apk. By default assembleAndroidTest will build the test apk with the debug build type. You can change the build type by adding this to your build. gradle file: android { testBuildType "release" ..

What are build variants in Android?

Build variants are the result of Gradle using a specific set of rules to combine settings, code, and resources configured in your build types and product flavors. Although you do not configure build variants directly, you do configure the build types and product flavors that form them.

How do you run a test case using gradle command?

Use the command ./gradlew test to run all tests.


1 Answers

./gradlew connected[Flavor]DebugAndroidTest

like image 156
ViliusK Avatar answered Sep 20 '22 15:09

ViliusK