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?
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.
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" ..
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.
Use the command ./gradlew test to run all tests.
./gradlew connected[Flavor]DebugAndroidTest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With