GithubHelp home page GithubHelp logo

Support soft assertions about cucumber-js HOT 4 CLOSED

user753 avatar user753 commented on September 13, 2024
Support soft assertions

from cucumber-js.

Comments (4)

davidjgoss avatar davidjgoss commented on September 13, 2024

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 like this.assertionErrors.push(error)
  • In an After hook, check your World for any assertion errors, and if there are > 0 then throw from there to fail the scenario

Relevant 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.

from cucumber-js.

user753 avatar user753 commented on September 13, 2024

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.

davidjgoss avatar davidjgoss commented on September 13, 2024

This is not currently possible, no. Assertions are not in scope of what Cucumber does as purely a runner.

from cucumber-js.

user753 avatar user753 commented on September 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.