I added a unit test folder in my Android studio project. The default folder is andoidTest, but instead I added a new folder and name. ( as tests of robolectric samples )
When I add Test Dependency to my build.gradle in a module like
testCompile("junit:junit:${junitVersion}") testCompile ("org.robolectric:robolectric:${robolectricVersion}")
They are not added to external libraries in the project, but when I use the default configuration and use androidTestCompile , it can add external libraries.
Then I thought that maybe I need to install Root for tests in gradle, so I used the following code in the android tag in the build.gradle file:
sourceSets { androidTest.setRoot('src/test') }
But the problem still remained. I can run tests using gradlew , but import into classes in the test folder is not applied, since the external library is not visible for testing purposes.
Does anyone have a solution for this problem?
android android-gradle unit-testing gradle robolectric
Ali
source share