Skip to content

Add support to skip scenarios on runtime #390

Closed

Description

@sschulz92

Is your feature request related to a problem? Please describe.
I need to skip scenarios on runtime as the system-under-test differs. Therefore I would like to have the Python-runner to support the PR: getgauge/gauge#2502

Describe the solution you'd like
Apply the changes done in C# also for Python.

Describe alternatives you've considered
None

Additional context
C# PR: getgauge/gauge-csharp-lib#42

Activity

  1. chadlwilson commented on Sep 26, 2024

    @chadlwilson
    Contributor

    If you want to have a go at implementing this, I am happy to make it a little easier by updating the protobufs to the latest so the message API is exposed to be consumed within the plugin :-)

  2. sschulz92 commented on Sep 27, 2024

    @sschulz92
    ContributorAuthor

    If you want to have a go at implementing this, I am happy to make it a little easier by updating the protobufs to the latest so the message API is exposed to be consumed within the plugin :-)

    Currently I am struggeling to understand where I need to throw and catch the "SkipScenarioException" in order to send the Gauge.Message to skip execution.

    My assumption:

    def execute_method(params, step, response, is_continue_on_failure=_false):
        start = _current_time()
        try:
            params = _get_args(params, step)
            step.impl(*params)
        except Exception as e:
            _add_exception(e, response, is_continue_on_failure(step.impl, e))
        response.executionResult.executionTime = _current_time() - start
        response.executionResult.message.extend(MessagesStore.pending_messages())
        response.executionResult.screenshotFiles.extend(ScreenshotsStore.pending_screenshots())
    

    If I catch the skip exception before the global exception, I would be able to overwrite the flag response.executionResult.skipScenario. Am I on the right track? 😄

  3. chadlwilson commented on Sep 27, 2024

    @chadlwilson
    Contributor

    I think something like that, yes.

    The gauge-dotnet impl (the first impl of this) basically looks at the exception type/name and sets the flag along with the equivalent ofresponse.executionResult.success = true (in contrast to for other types of exceptions.

    https://github.com/getgauge/gauge-dotnet/pull/210/files#diff-664ffb133211070e87590f3c0c836d8a2f3b56c9b17c81c24a08479e5d26848dR58-R80

    When the exception is raised by the user, the reason is reported with a message.

    https://github.com/getgauge/gauge-csharp-lib/pull/42/files#diff-8c944c5931788afb31fb92049426343c0f2f96f846906dbb4b65b485ad811c6cR16

  4. linked a pull request that will close this issueSkip test scenarios at runtime #397on Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions