I didn't find any reference for the possibility to re-run failed tests (using protractor). Do you know how to do that? It would be great because I have a lot of tests and I don't like to run again all the tests to verify whether the previously failed tests passes or not.
Do anyone have experience with it? It would like this:
- run all tests
- collect failed tests and run those again (maybe I can set somehow the re-try limit like 2 or 3 times)
- show the result
As far as I understand, currently it is not possible, but there is an open feature request:
As of sept 9th 2016, the only way that's available to rerun failed tests in your cucumber/protractor e2e tests is with NickTomlin's protractor-flake.
Protractor-flake is "a wrapper for protractor to automatically re-run failed specs for a specific number of attempts", check out these two links for steps on how to implement it:
- https://www.npmjs.com/package/protractor-flake
- https://github.com/NickTomlin/protractor-flake/blob/master/docs/cucumber.md
Please pay attention to the Caveat section under that NPM link above:
*Caveats
This has not yet been tested with Protractor + Mocha. It should function similarly. Please update with an issue or PR if this is not the case.
Tests will not re-run properly (all tests will run each time) if you use a custom reporter that does not log stacktraces for failed tests. For example, if you are using jasmine-spec-reporter with Jasmine 2.0, make sure to set displayStacktrace: 'specs' or displayStacktrace: 'all'.*
Cucumber has own property to rerun failed tests, you just need to paste:
cucumberOpts : {
require : [
'...'
],
format : 'rerun:path/to/@rerun.txt'
}
and then to run tests using this file.
来源:https://stackoverflow.com/questions/27725237/re-run-protractor-timeout-or-failed-tests