run failed test cases automatically with jenkins
How we achieve this is by monitoring the
Jenkins job console output using the
‘Conditional Buildstep‘ plugin for Jenkins.
The plugin allows you to configure a job so
that you search for a text string in the
console log and if you pick up a string
that indicates a failure then you
run a conditional build step.
That conditional build step is configured
to run the test a 2nd time. If it runs
and passes on the 2nd attempt then the
overall build status is set to pass and
you ignore the results from the 1st attempt.
Basically we are aiming
- run a test
- check the status of the test result
- if the test result is a pass then end the run
- if the test results is a fail then try and run again