Prevent failing test from failing the task/build (CI)
I have recently set up protractor for e2e tesing our angular applications. The projects are build and tested with gradle script. I'm using gradle-node-plugin to run protractor test after the project is built.
The problem is that a failing protractor test causes the build-job to fail (becomes red on jenkins) - this is not the desired behaviour. Failing tests should make the job yellow and ERRORS like 'Selenium server cannot be started' must make the job red.
I was looking for a configuration flag like
failTaskOnTestFailure = false but didnt find anything.
gradle-node-plugin has an option ignoreExitValue = true but this does not help as it will also ignore other Errors like syntax errors in the spec and the job becomes green as no tests runs and fails.
Is there a way to make protractor behave that way?
A working alternative I tried is letting the onCleanUp : function(exitCode) { return a new status code, this way I can change 1 back to 0.
The line you're interested in is
var exitCode = passed ? 0 : 1;
in lib/runner.js.
You can feel free to change that line to output whatever exit code you want. However, I feel that it is the correct behavior for exit code to be non zero on test failure.
However, I feel that it is the correct behavior for exit code to be non zero on test failure.
Agreed, but which code can I use which does not fail the gradle-task? I have added a question at gradle-node-plugin
This is a question for gradle - closing as answered here.