Closed user753 closed 11 months ago
Most JavaScript assertion libraries don't have a soft assert concept. But you could implement something in Cucumber, where you:
World
e.g. something like this.assertionErrors.push(error)
After
hook, check your World
for any assertion errors, and if there are > 0 then throw from there to fail the scenarioRelevant docs:
Happy to discuss more in #help-cucumber-js in the Slack, but going to close the issue as there's nothing for us to change here.
Thanks.
Most JavaScript assertion libraries don't have a soft assert concept. But you could implement something in Cucumber, where you:
Would it be possible to add soft to StepOptions?
export interface IDefineStepOptions {
timeout?: number;
soft?: boolean
wrapperOptions?: any;
}
Then({soft: true}, ...)
In an After hook, check your World for any assertion errors, and if there are > 0 then throw from there to fail the scenario
Yes, I do something like that, but I would like to show this step as failed in report. Is it possible?
This is not currently possible, no. Assertions are not in scope of what Cucumber does as purely a runner.
Assertions are not in scope of what Cucumber does as purely a runner.
But it's not about assertions, it's about running the test. I want to continue running the scenario even if some steps fail. There is already a similar feature for when there is no implementation for a step. Instead of stopping after the first missing step, it continues running to collect all missing steps. My case is exactly the same, but the problem isn't a missing step implementation, it's something else.
I would like to fail some step but continue to run scenario after that. Is there any way to do it?