Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support programmatically skipped scenarios (e.g if a scenario has a dependency failure) #691

Open
serhatozdursun opened this issue Jul 4, 2022 · 3 comments

Comments

@serhatozdursun
Copy link

I am working on an API product. Some endpoints are associated with 3rd party endpoints. Sometimes we may receive an error that does not belong to our product. In this case, I should be able to bypass this scenario without failing the whole feature.

If there was a feature which allow me skip the scenario with certain case , it would be awesome. It could be static method like Gauge.skip("skip reason");

@chadlwilson chadlwilson changed the title I need a feature that skip the scenario, if the scenario have failure Support programmatically skipped scenarios (e.g if a scenario has a dependency failure) Oct 14, 2024
@chadlwilson
Copy link
Contributor

chadlwilson commented Oct 14, 2024

This is possible to be implemented now with the support for getgauge/gauge#2502 , modeled off gauge-dotnet or gauge-python. Help welcome :-)

@serhatozdursun
Copy link
Author

I'll have a look at the first availble time.

@chadlwilson
Copy link
Contributor

See getgauge/gauge-python#397 and getgauge/gauge-python#390 for some discussion of how to implement it.

Although more similar to Java the gauge-dotnet one is a bit harder to unpack as an example as the logic is spread into a shared library which other plugins don't have.

Basic steps for consistency

  • create a SkipScenarioException type available to users to throw in the plugins API which includes a reason/message for the skip.
  • emit the message back to Gauge.
  • catch these exceptions during step execution and hooks.
  • instead of failing the scenario set the step to passed and set executionResult.skipScenario flag to true (it should default to false)

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

No branches or pull requests

2 participants