Jenkins marks a build as failed if a shell script step returns an error exit code (anything but 0).
Failing tests aren't errors in the test executor, so these calls probably return 0 (successful), and are interpreted by the shell as such. You need to parse the output in some way, and, if it matches your error condition, `exit 1`. If `adb` writes something useful to standard out, you could use something like the following (assuming `bash`): adb ... | tee tmp.log [[ -z "$( grep 'Test failed' tmp.log )" ]] || exit 1 Otherwise, you'll need to parse your test reports. There might be addons helping you with that, e.g. the xUnit plugin. It'd also allow you to distinguish between failed executions, and test failures (marking the build as 'unstable'). On 07.08.2013, at 21:14, Lin Chen <lin.c...@kaldorgroup.com> wrote: > So I defined many UiAutomatorTestCase classes, each has 1 or 2 test cases at > the most. > Then I use Shell script on Jenkins to string these test cases into a series > of tests, for example: > > adb shell uiautomator runtest myTest.jar -c com.myTest.TestClass1 > adb shell uiautomator runtest myTest.jar -c com.myTest.TestClass2 > adb shell uiautomator runtest myTest.jar -c com.myTest.TestClass3 > adb shell uiautomator runtest myTest.jar -c com.myTest.TestClass4 > ... > so on so forth. > > one of the two (1/2) problems I have is that with Jenkins builds, it doesn't > matter if any of these test fails, Jenkins always shows up as green, I need > Jenkins stop and shows red for the build. > > the other (2/2) problem is that if the app crashes in one of the tests, say, > TestClass2, the script will try to pick up and continue executing. What would > be the best method to make the script stop? > > Any suggestions? > Thanks > > > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.