I am a QA with a start up company. My Developer setup Instrumentation tests in the Android Project. He also setup the Jenkins Jobs to run these tests in CI env.
This is the command given in "Tasks" field in Jenkins job under Build --> Invoke Gradle script. clean assembleDebug connectedAndroidTest testDebug
I would like to create my own Jenkins job to run different types of tests. Is there a way that I can filter my tests by just running "connectedAndroidTest" command? I tried using shell script like the following, but it didn't work. adb shell am instrument -w /
I am getting the following error message: [Execute Smoke Test Suite] $ /bin/bash -xe /var/folders/qr/vtm32_d56vz0hgwg5ppdbswc00007q/T/hudson1779650135635362469.sh + adb shell am instrument -w ' ' class com.draysonwireless.airmapandroid.rewards/BonusTest.java /var/folders/qr/vtm32_d56vz0hgwg5ppdbswc00007q/T/hudson1779650135635362469.sh: line 2: adb: command not found Build step 'Execute shell' marked build as failure Finished: FAILURE
Seems that your jenkins user can't see android adb therefore build fails. Add adb to the system path or point it's exact location.
As to running specific tests via gradle command below is an example:
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.android.testing.blueprint.ui.espresso.EspressoTest#testMethodName
Taken from here with my slight modification. Your connectedAndroidtest
command can vary depending on the test flavour existence.