Hi,
I am invoking the protractor command from maven pom.xml, as i want to call another command to invoke custom reporter after protractor tests have run. But when the test case fails, it makes the entire build as failed (Reason : [launcher] Process exited with error code 1)
Executed 26 of 26 specs (1 FAILED) in 50 secs.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52.922 s
[INFO] Finished at: 2015-12-01T16:16:29-05:00
[INFO] Final Memory: 9M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (exec-protractor) on project protractor-sample: Command execution failed. Process exited with an error: 1(Exit value: 1) -> [Help 1]
Here is my pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>exec-protractor</id>
<phase>generate-sources</phase>
<configuration>
<executable>./node_modules/.bin/protractor</executable>
<arguments>
<argument>config/config.js</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
I think this is a question about your maven set up. Protractor will (and should) exit with error code 1 when a test fails. You should catch this if you would like to do something else.
Closing as a question. Please see https://github.com/angular/protractor/blob/master/CONTRIBUTING.md#questions
Actually I'd like to have possibility to suppress exit code on failed tests as well
--exit_code_on_failed_tests=0
I would also like to have the same feature to suppress the exit code
I am running the test in a jenkins job and due to exit code it fails the complete job.
But what i would like to is check how many tests passed and if one test failed i would want to continue my job and use that release.
I have the same problem on jenkins, @juliemr does exists any option like "--exit_code_on_failed_tests=0" ?
There is no option like this in Protractor. Please use a separate node process / script to catch the error and do with it what you want. You could do this by running Protractor from a different script that catches the error code so you can do with it what you want.
An example can be how protractor-flake does it. This is a kind of wrapper around protractor and will check the exit code. If the exit code is 1 it will parse the logging to rerun tests. You can build the same logic and do your stuff you need to do in your own script.
The most common DevOP's workflow today with modern CI pipelines is to run all tests and generate a report about the test run. Allowing the user to set args directly when calling protractor would always be preferable and better for passing arg values on the fly vs increased maintenance costs of a wrapper script.
There is no option like this in Protractor. Please use a separate node process / script to catch the error and do with it what you want.
@wswebcreation How can I make the distinction between a _failed test_ and _failure to execute tests_ (because of missing dependency or configuration issue) if both return the same exit code?
Most helpful comment
Actually I'd like to have possibility to suppress exit code on failed tests as well
--exit_code_on_failed_tests=0