Issue
I have successfully create a Android project in IntelliJ 13 and I want to setup the Android Testing Framework. I used the new project wizard to create the android project using Gradle. When I go to add a new module I only have options for "Gradle: Android Module" and "Gradle: Java Library", the "Test Module" option is missing.
How do I generate an Android Test Module? I have read http://www.jetbrains.com/idea/webhelp/testing-android-applications.html but I can never find any "test" option.
If an Android Test Module can not be automatically generated, then how do I configure and use the Android Testing Framework with a Gradle Android Project? Links to examples or documentation is very much appreciated.
Details: IntelliJ 13.1.3
Solution
So currently your directory structure should look something like this:
ProjectDirectory/
res/
src/
main/
java/
your.package.name
MyClass.java
All you need to do is add a src directory for androidTest
:
ProjectDirectory/
res/
src/
main/
java/
your.package.name
MyClass.java
androidTest/
java/
your.package.name
MyClassTest.java
and then resync your Gradle file with your project, and it should be detected as a test directory. Then you can run the connectedCheck
or connectedAndroidTest
tasks (I'm unclear on the difference in the two) to run the tests.
If your directory structure differs from the above (if, for instance, you important an Eclipse-style project), you can specify the alternate src directory in your build.gradle script:
android {
sourceSets {
androidTest {
java.srcDirs = ['path/to/test/src']
}
}
}
Answered By - Kevin Coppock
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.