Configure test folder for unit testing in Android studio -


i have added folder unit testing in android studio project. default folder andoidtest have added new folder , name in test instead. (like robolectric sample tests)

when add test dependency in build.gradle under module such

testcompile("junit:junit:${junitversion}") testcompile ("org.robolectric:robolectric:${robolectricversion}") 

they not added external libraries under project, when use default configuration , use androidtestcompile, can added external libraries.

then thought maybe should setroot tests in gradle, used following in android tag in build.gradle:

sourcesets {         androidtest.setroot('src/test') } 

but still problem remained. can run tests using gradlew, imports in classes in test folder not apply no external library test purpose visible.

anyone have solution issue?

i searching , didn't find answer thought covered this. decided create new 1 future.

answer android studio not picking unit tests automatically right now. know planned 1.3 version.

so have change test artifact value android instrumental tests unit tests in build variants tool window: enter image description here


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -