Is it possible to run single tests using Robolectric-Gradle plugin?
I tried with this:
./gradlew test -Dtest.single=testName
But it is not working.
Made the same mistake myself. Thats the format for jcandksolutions plug-in (at least that's what I was using). -Dtest.single=<test name>
is not supported by RoboE-Gradle plugin.
Use --tests <test class name>
mechanism. This can be either --tests <classpath of test>
or wildcard with --tests *.*Test
The method described in the original question does work but you must be working with the latest versions of the robolectric gradle plugin as per docs here
So currently in your dependencies section you'll need
classpath 'org.robolectric:robolectric-gradle-plugin:1.0.1'
If you are updating from 0.xx, as I was, you'll probably need to change the dependencies from androidTestCompile
to testCompile
to build your tests.
Then as above
./gradlew test -DtestDebug.single=<NameOfTestClass>
Will run just your single test (Notice it assumes your test class ends in *Test so you can skip it from the command)
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.