You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support programmatically skipped scenarios (e.g if a scenario has a dependency failure) #691
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");
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)[/+]on Oct 14, 2024
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)
Although SkipScenarioException is caught and a proper ProtoExecutionResult with skipScenario = true is returned, the scenario continues executing, and the final report still shows 0 skipped scenarios.
This makes it behave more like a silent "pass" than a proper skip.
I believe this behavior may need to be handled in the Gauge core engine (gauge/gauge) or via changes in the message definitions (Messages.proto) so that:
Execution is halted after skip
The skipped scenario is counted correctly in the report
It reflects accurately in CLI output and HTML reports
🙋 Request:
Could you please advise where to hook into the core behavior to support early exit on skipScenario = true?
Do we need corresponding changes in the Gauge engine or the message handling layer?
I don't follow what you're saying about a silent pass, sorry. You might want to review the behaviour with the other language plugins already implementing this noted above and see if yours is different. Or may need to be more explicit with an example.
The HTML report not noting the scenario as skipped is a separate issue at getgauge/html-report#320 however different than core behavior.
I thought it reflected accurately in CLI output though? Are you sure this is also affected?
Activity
[-]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)[/+]chadlwilson commentedon 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 commentedon Oct 14, 2024
I'll have a look at the first availble time.
chadlwilson commentedon Oct 14, 2024
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
executionResult.skipScenarioflag to true (it should default to false)serhatozdursun commentedon May 11, 2025
👋 Hi @chadlwilson ,
I’ve implemented a feature to allow skipping scenarios programmatically using:
🔧 What I’ve added:
SkipScenarioExceptionGauge.java:MethodExecutor.java:Updated merging logic:
⚠ Problem:
Although
SkipScenarioExceptionis caught and a proper ProtoExecutionResult with skipScenario = true is returned, the scenario continues executing, and the final report still shows 0 skipped scenarios.This makes it behave more like a silent "pass" than a proper skip.
I believe this behavior may need to be handled in the Gauge core engine (gauge/gauge) or via changes in the message definitions (Messages.proto) so that:
Execution is halted after skip
The skipped scenario is counted correctly in the report
It reflects accurately in CLI output and HTML reports
🙋 Request:
Could you please advise where to hook into the core behavior to support early exit on skipScenario = true?
Do we need corresponding changes in the Gauge engine or the message handling layer?
chadlwilson commentedon May 11, 2025
I don't follow what you're saying about a silent pass, sorry. You might want to review the behaviour with the other language plugins already implementing this noted above and see if yours is different. Or may need to be more explicit with an example.
The HTML report not noting the scenario as skipped is a separate issue at getgauge/html-report#320 however different than core behavior.
I thought it reflected accurately in CLI output though? Are you sure this is also affected?
feat: add support for skipping scenarios via SkipScenarioException
feat: add support for skipping scenarios via SkipScenarioException
feat: add support for skipping scenarios via SkipScenarioException
feat: add support for skipping scenarios via SkipScenarioException
feat: add support for skipping scenarios via SkipScenarioException (#924