I'm running test on an Android device using the monkey tool. The problem is the Jenkins pipeline passes as SUCCESS even when monkey crashes the app. Is there a way to get the exit code from sh or the monkey tool and mark the stage as a FAILURE?
stage('monkeytest'){
node('android'){
git credentialsId: '731f2b68-2c6d-', url: 'https://mygitrepo.git', branch: 'master'
sh './gradlew installDebug'
sh '/android-sdk-linux/platform-tools/adb shell monkey -p com.my.package -c android.intent.category.LAUNCHER 10000'
}
}
Use sh
with returnStatus
result = sh('/android-sdk-linux/platform-tools/adb shell monkey -p com.my.package -c android.intent.category.LAUNCHER 10000', returnStatus : true)
if (result != 0) {
// handle errors
}