connectedAndroidTest task runs all test even when class is specified

446 views Asked by At

I m trying to run instrumented unit tests using connectedAndroidTest. At first I jus wanted run to particular class using cAT. So I tried below command

./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.company.test.data.model.TestClassName

but it runs all the tests including the robotium and espresso tests which were written. I gone through lots of StackOverFlow posts, in all posts the answer is the above specified command.

when I tried adb shell am instrument -e class com.company.test.data.model.TestClassName com.company.test/android.support.test.runner.AndroidJUnitRunner

It ran the tests as expected. The problem is I wont get jUnit Reports by the adb command but cAT will provide me test reports, code coverage reports as required.

Does anyone have solution for this issue to run specific tests?

1

There are 1 answers

0
Arvind On BEST ANSWER

It was actually the problem with gradle version. The developers had set the gradle version to 2.3 in which I was facing the issue. Then I have updated the gradle version to 2.10 and the issue is fixed.