Request to Add Soft Assertion on wdio-cucumberjs-json-reporter
anandmdas opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
When we are performing E2E executions we may need to perform a textual validations or some validation which doesnt need to stop the execution but mark the step and scenario as failed.
As currently the only way to mark a step and scenario as failed is only once we use a throw statement the execution stops there
Example: Take a scenario as you are performing an E2E regression and you need to perform some content validation. Say the content validation is failed, but I can still perform the functionality is working fine or not. But in this case with the current implementation I have to use a throw statement to report failure, which will stop the execution. Instead create a method with which we can mark the testcase as failed with a description
Proposed Solution
Approach 1:
Create a static method with which we can mark the step and scenario as failed
Approach 2:
Make the current step object and scenario object assessable from any where in the project so we can create a mapping and the step can be marked as fail using after hooks
I will prefer approach 1 as that is more user friendly and the approach 2 we may still need to terminate the execution after the step fails
Reference link on similar feature for playwright and cypress
https://playwright.dev/docs/test-assertions
https://medium.com/@pipulpant/leveraging-hard-and-soft-assertions-for-effective-testing-48dc36e3451c
https://docs.cypress.io/guides/references/assertions
https://github.com/elaichenkov/playwright-expect
Duplicate of webdriverio/expect-webdriverio#227 ?
Closing as duplicate then. Please get involved if you like this feature to land. Thank you!