Skip to content Skip to sidebar Skip to footer

Flavors And Instrumentation Tests - Gradle Configuration

I use flavors in my project and I wanna add add instrumentation tests specific for each flavor. So I created MyApplication/src/androidTestFlavor1/java/com.package.test MyApplicatio

Solution 1:

When you setup a new project in android studio it creates a main folder and an androidTest folder. Gradle uses the androidTest folder for common tests across all flavors. See link. So if you try try to write a flavour specific test and put it in the androidTest folder, it will be run against all your flavors and will probably fail.

So if you want to create flavor specific tests you need to add a new test folder for that flavor containing the java folder and your test. The naming convention has to be androidTestFlavorName. See image below.

enter image description here


Post a Comment for "Flavors And Instrumentation Tests - Gradle Configuration"