Re-run protractor timeout or failed tests

∥☆過路亽.° 提交于 2019-12-08 06:40:44

问题


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

回答1:


As far as I understand, currently it is not possible, but there is an open feature request:

  • Feature to execute failed tests only



回答2:


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:

  1. https://www.npmjs.com/package/protractor-flake
  2. 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'.*




回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!