I want to add robolectric tests to my project in intellij.
I have tried to follow this tutorial
but I cannot add "test" package under my main module.
In addition the "build variants" look different than in the tutorial.
how can I fix this?
how can I add test class properly?
this is not the way, the good architecture is:
/app
/src
/main
/java
/com.your.package
/test
/java
/com.your.package
and don't forget to write it in the app module build.gradle
android {
sourceSets {
main { java.srcDirs = ['src/main/java'] }
test { java.srcDirs = ['src/test/java'] }
}
}
I guess you had an outdated tutorial. Android Studio changed, there is no need to use Build Variants to distinguish between UnitTest and AndroidTests anymore.
Just create the TestFolders manually. eg app/scr/androidTest
and put your test Files there.
Maybe just create a new Project with android Studio. The Folders for tests will be atomatically created, you'll see what i mean.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.