-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add support for skipping scenarios via SkipScenarioException #924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for skipping scenarios via SkipScenarioException #924
Conversation
Did you resolve your challenge/confusion noted in the discussion at #691 (comment) ? |
@chadlwilson I realized that my initial approach was incorrect, so I rolled back those changes. I’ve now aligned the solution with the approach used in gauge-python/pull/397 which addresses the issue described in gauge-python/issues/390 |
a898386
to
5cee28c
Compare
@chadlwilson boolean skipped = execResult.getSkipScenario() | previousStageResult.getSkipScenario();
builder.setSkipScenario(skipped); Without this, a skipped scenario would be incorrectly treated as passed when results are merged. |
Cool - seems to make sense. I am not familiar with the merge logic but when you've addressed the checkstyle errors and signed your commits I'll take a deeper look :-) https://github.com/getgauge/gauge-java/pull/924/checks?check_run_id=42041532879 |
@serhatozdursun Thank you for contributing to gauge-java. Your pull request has been labeled as a release candidate 🎉🎉. Merging this PR will trigger a release. Please bump up the version as part of this PR.Instructions to bump the version can found at CONTRIBUTING.md If the CONTRIBUTING.md file does not exist or does not include instructions about bumping up the version, please looks previous commits in git history to see what changes need to be done. |
41f7ef4
to
d0bb60a
Compare
- Introduced `SkipScenarioException` in the Gauge API to allow users to skip scenarios programmatically. - Updated `MethodExecutor` to catch `SkipScenarioException` and return a `ProtoExecutionResult` with `skipScenario=true`, an appropriate message, and no failure flag. - Added unit test `testStepMethodExecutionWithSkipScenarioException` in `StepExecutionStageTest.java` to verify the behavior. This implements the feature request from issue getgauge#691 by allowing steps to skip execution cleanly using `Gauge.skip("reason")`. Signed-off-by: mehmetozdursun <[email protected]> Signed-off-by: serhatozdursun <[email protected]>
Signed-off-by: serhatozdursun <[email protected]>
fix the format issue which cause the fail Signed-off-by: serhatozdursun <[email protected]>
Signed-off-by: serhatozdursun <[email protected]>
a9f47e8
to
5f028fe
Compare
Signed-off-by: Chad Wilson <[email protected]>
Thx - the stage merging is still a bit confusing to me, but seems to me it might have the problem you mention if the skip scenario exception is thrown during a hook rather than during the step itself, or thrown during the step and for a method which has an "after" hook that applies. But I'm also not super familiar with the hooks. Anyway, I've added a test for that exec result merging, tidied up a bit and will release this. I also changed the message to emit directly what people put in their exception message to return full control to the user rather than prefixing with |
Overview
This PR addresses issue #691 by introducing native support for skipping scenarios
🔧 Changes Made
SkipScenarioException
, which can be thrown to trigger a skip.MethodExecutor
to catchSkipScenarioException
, mark the step asskipScenario = true
, and prevent it from failing.SKIPPED: <reason>
messages in the execution result.StepExecutionStageTest
with a new test:testStepMethodExecutionWithSkipScenarioException
.