Issue
I would like to skip the build process and directly run tests when I do
./gradlew connectedDevDebug
I could also use adb command but it will run test on only one deivce at a time.
Solution
There is currently no gradle
tasks that just runs the tests.
But once you have installed (and run) the tests, you can (re-)run them directly with the am instrument
command. To start them from your development machine's command line just run:
adb shell am instrument -w <test_package_name>/<runner_class>
You can copy the actual command from AndroidStudio's output. Just run the tests from AndroidStudio, and then scroll to the top of the test log view.
There is one caveat, am instrument
does not create any test-reports. All test results are written to stdout
. However you could pipe stdout
into a file and create a report yourself. I.e. this tool can create an xml JUnit test report from the output of am instrument
.
If you have made changes to the tests you can rebuild and install them with:
./gradlew installDebugAndroidTest
For detailed information and instructions about starting tests from the command line you can refer to the official article Test from the Command Line
Answered By - thaussma
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.