Comments (4)
Most JavaScript assertion libraries don't have a soft assert concept. But you could implement something in Cucumber, where you:
- Catch the assertion error
- Add an item to a list on your
World
e.g. something likethis.assertionErrors.push(error)
- In an
After
hook, check yourWorld
for any assertion errors, and if there are > 0 then throw from there to fail the scenario
Relevant docs:
- https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md
- https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/hooks.md
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.
from cucumber-js.
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?
from cucumber-js.
This is not currently possible, no. Assertions are not in scope of what Cucumber does as purely a runner.
from cucumber-js.
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.
from cucumber-js.
Related Issues (20)
- Update Test Step Status programmatically
- Recent tmp update breaks cucumber-js on Node14 HOT 4
- getting the report after running cucumber programmatically HOT 1
- Inject steps at runtime HOT 1
- Question - How to provide multiple feature file path in cucumber.js file HOT 1
- can we use this with cypress and typescript HOT 1
- Background steps are reported without keyword Background in json report HOT 9
- Step with result status = pending does not contain an error_message HOT 1
- worldParameters not modifiable using Before and After hooks after updating to the latest versions after v10.0.1 HOT 4
- ESM with TS not working HOT 1
- ESM mode with ts-node breaks TypeScript path alias resolution in cucumber-js HOT 5
- JSON format issue, especially with larger reports, such as 500MB in size HOT 4
- CustomWorld Context Retention between Steps of the same Scenario: (JS Only) Backwards Compatibility (Known to be affected 8.11.1-9.6.0) && 10.8.0 with TS 5.4.5 HOT 7
- Facing Issue with Parallelism in Jenkins while running Playwright Cucumber tests HOT 8
- Running Cucumber In the Browser?
- Obsolete dependencies
- Concurrency: Allow IPC between workers and coordinator, and/or custom Runtime impls HOT 4
- Cucumber Report and local output is different for playwright-cucumber.js
- Implement unified runner concept
- Progress Formatter Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cucumber-js.