codeceptjs / CodeceptJS

Supercharged End 2 End Testing Framework for NodeJS
http://codecept.io
MIT License
4.11k stars 724 forks source link

Gherkin retry on failed features and scenario #1543

Open mayankchincholkar opened 5 years ago

mayankchincholkar commented 5 years ago

Retry failed scenario and feature in gherkin BDD format

What do you get instead?

Retry feature is present when using the spec implementation where we can actually do something like Feature('test something').retry(3);

Is it possible to use or have the similar feature in gherkin feature file, where we can retry the failed scenario or feature?

Details

ryust-ax commented 4 years ago

There is https://codecept.io/bdd/#before (CodeceptJS 2.6.6) where in /step_definitions/steps.js I have the following:

Before((test) => {
  const retryCount = 3;
  test.retries(retryCount);
});

This works like a charm.
However, that same page suggests to use Fail(); with which works sort of.... Attempting to do something like Fail((test, error) => { console.log(test); console.log(error); }); only winds up crashing my framework due to Max Heap usage.
Using console.log(test) in other areas like Before() or After() works just fine.
I'm still troubleshooting but maybe that'll point you in a useful direction?