Skip to content Skip to sidebar Skip to footer

Create Separate Test Module/project In Android Studio

I'm using Android Studio version 0.8.14. Currently, after creating a new Android project, by default the test source code folder androidTest is located inside the src folder of the

Solution 1:

If I understand what you are asking, the bit of information that you might be missing is to add something like:

include':my app module', ':my test module'

to your settings.gradle file. I use this technique to separate out my 'connected' tests from pure unit tests. You might be interested in checking out a fork that I made of the popular deckard-gradle project that does exactly this: https://github.com/jdonmoyer/deckard-gradle

Solution 2:

The technique for specifying a test directory other than "androidTest" is to add a "sourceSets" configuration option to the "build.gradle" file as shown below:

 sourceSets {
        androidTest {
            setRoot('src/test')
        }
 }

The above example would only change the name of the test directory from "androidTest" to "test".

But you could try the same technique using a relative or full path name such as

setRoot('../my test module/my app module/src/androidTest')

or

setRoot('../../My Test Project/src/androidTest')

Post a Comment for "Create Separate Test Module/project In Android Studio"