I made a Selenium script who will be executed by jenkins, when all the test results are ok jenkins says that everything is good (with the blue point) but when the test resut are failed (and the console output says that it failed) the point stills blue and it's supposed to be red and upload a mantis report but this doesn't happen. The first screenshot it's the test results, the second one its the blue point, and the thirt one it's the console output (in the comment section this one)
Asked
Active
Viewed 477 times
0
-
http://imgur.com/XrknBE1 Thirt image. – Nic Apr 13 '15 at 22:38
-
What framework do u use? junit/testng? How do you run your test - Ant/Maven? What is the build step you have in jenkins? – vins Apr 14 '15 at 00:41
-
@VinothS No, i'm not using any of them...I'm just running selenium's scripts in jenkins – Nic Apr 14 '15 at 13:16
1 Answers
0
Your script needs to return a non-zero exit code when failures happen. For example, if your script is a Windows command line script, you can use this code:
echo Tests failed! Returning a non-zero exit status...
exit 1
This will fail the build in Jenkins and change the circle color to red.
Alternatively you can use the Log Parser Plugin to search the build log for "Tests failed" and mark build as failed.

Eugene C
- 516
- 3
- 11
-
This worked!! And helped to upload the ticket to mantis, but there is a problem: Now when I run a good test the circle is red and it's supossed to be blue :( There is the final lines frome the console output: http://www.pastebin.ca/2972138 – Nic Apr 14 '15 at 16:14
-
@NicolasSantisteban, what's the command that you're using for running the tests? You can use the [if statement](http://ss64.com/nt/if.html) to only fail the build when your tests failed. But you'll need to know what to use as the condition and that depends on the specific tool or script you're using. If this sounds too complicated you can try the alternative solution I provided in my answer. – Eugene C Apr 14 '15 at 16:51