Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple test folders in module

I have setup my Android project with Gradle 2.2.1, which contains one module. This has a folder named "androidTest" where I'm placing the tests. This is standard in the Android plugin for Gradle and it works.

Now, I would like to have two different test suites for the same project, each one of them located in a different directory.

Is this possible?

I was thinking of creating two different tasks "extending" connectedAndroidTest, and each one overwriting the folder of the tests...

Any ideas?

like image 476
GaRRaPeTa Avatar asked Mar 15 '26 00:03

GaRRaPeTa


1 Answers

A little old, but it was the first result when I was searching!

So this is fairly easy, you can just add each folder to the source sets:

android {
...
    sourceSets {
        androidTest.resources.srcDirs += 'src/newAndroidTest/resources'
        androidTest.java.srcDirs += 'src/newAndroidTest/java'
    }
}

These folders should now be included with the current src/androidTest folders when you run them.

like image 55
Ben Neill Avatar answered Mar 16 '26 15:03

Ben Neill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!