android - Flavors and instrumentation tests - gradle configuration -


I use flavors in my project and I want to add specific instrumentation tests for each taste.

I made

  MyApplication / src / androidTestFlavor1 / java / com.package.test MyApplication / src / androidTestFlavor2 / java / com.package.test  < / Pre> 

But it does not work correctly.

Therefore, I have tried to configure it in build.gradle, I have added

  android {... sourceSets {flavor1 {InstrumentTest.setRoot ('src / InstrumentationTestFlavor / java ')}} ...}   

But I get an error:

Error: (59, 0) On the source set ding Property 'instrument' could not be found.

What's the best solution here?

When you set up a new project in Android Studio, this is a main folder and an Android Test folder makes. Gradle uses the androidTest folder for common tests in all flavors. So if you try to write a taste-specific test and put it in the Android Test folder, then it will run against all your flavors and may fail.

So if you want to make a taste-specific test, add a new test folder for that taste containing the Java folder and your test. Naming Convention should be AndroidTestFlavorName See image below

Enter image details here < / Html>

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -