The Execute shell task will mark a build successful if your script exits with an exit status of 0
. All other exit statuses will mark the build as failed. Within your monkeyrunner script, you can use the exit()
statement to set your exit status.
# test some stuff...
if xyz:
sys.exit(0) # success
else:
sys.exit(1) # failure
If you need something more granular, you can use something like the Text-finder Plugin to parse the output of your Monkeyrunner scripts if using the exit code is insufficient.
edit: to clarify, add an Execute shell step, and invoke your monkeyrunner script from within that step. If the script exits with a status of 0
, Jenkins will continue, otherwise it will fail the build.
You may need to provide the full path of the monkeyrunner interpereter, i.e:
/path/to/android-sdk/tools/monkeyrunner my-script.mr