Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      As someone writing scenarios, I want to be able to use another scenario as a Given, so that I don't have to write big long scenarios.

      Not sure how this would work - at the moment we can get around it on the code side. I'm guessing we're looking for something like

      Given the glider

      where the_glider is a scenario file.

      (What would we do if the_glider had two scenarios in it? Throw an exception, maybe?)

        Activity

        Hide
        Mauro Talevi added a comment -

        We could also accept both scenarios:

        GivenScenarios contained in the glider

        where the glider can have as many scenarios as the user requires.

        Show
        Mauro Talevi added a comment - We could also accept both scenarios: GivenScenarios contained in the glider where the glider can have as many scenarios as the user requires.
        Mauro Talevi made changes -
        Field Original Value New Value
        Affects Version/s 2.0.1 [ 14549 ]
        Affects Version/s 2.1 [ 14547 ]
        Component/s Core [ 11086 ]
        Affects Version/s 2.0 [ 14456 ]
        Fix Version/s 2.2 [ 14670 ]
        Mauro Talevi made changes -
        Affects Version/s 2.1 [ 14547 ]
        Affects Version/s 2.0 [ 14456 ]
        Affects Version/s 2.0.1 [ 14549 ]
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Mauro Talevi added a comment -

        I'm thinking that GivenStory would be more suited as keyword, where the given story may contain one or more scenarios.

        Show
        Mauro Talevi added a comment - I'm thinking that GivenStory would be more suited as keyword, where the given story may contain one or more scenarios.
        Hide
        Elizabeth Keogh added a comment -

        GivenStory doesn't make any sense to me. I'm starting to think that Story, being another BDD domain term, should be a completely separate object from Scenario (and the various types of Scenario). It might have Scenarios as part of it. To run a GivenScenario, we might want to identify which Scenario in the Story is being run.

        Running all the Scenarios in a story to set up the context for anther Scenario makes no sense to me. Each Scenario could well leave the application in a different state, so what context would you set up in the Given? What state would you have, in which to perform the other steps?

        No idea how Story as a separate object would work, but it feels like the right thing to do. Thoughts? 3.0 maybe?

        Show
        Elizabeth Keogh added a comment - GivenStory doesn't make any sense to me. I'm starting to think that Story, being another BDD domain term, should be a completely separate object from Scenario (and the various types of Scenario). It might have Scenarios as part of it. To run a GivenScenario, we might want to identify which Scenario in the Story is being run. Running all the Scenarios in a story to set up the context for anther Scenario makes no sense to me. Each Scenario could well leave the application in a different state, so what context would you set up in the Given? What state would you have, in which to perform the other steps? No idea how Story as a separate object would work, but it feels like the right thing to do. Thoughts? 3.0 maybe?
        Hide
        Mauro Talevi added a comment -

        I agree that story should be a separate model concept. The issue here is that we started with the Scenario concept and then added the ability to run multiple scenarios, which in my mind constitutes a story. So I would only run a story (ie a set of scenarios) to set up a context for another story - that's why I was thinking of calling it GivenStory. I think this could be retrofitted in 2.x codebase, possibly. Else we could branch off a 3.x and revisit the whole model to be more story-aware.

        The alternative of keeping the GivenScenario as a context set up for each scenario is possible, but complicates the parsing IMO in case you had multiple GivenScenario in a single file. We need to evaluate which of the two use cases is more used. I'm thinking that most likely users would need a single setup call for all the scenarios in their file.

        Show
        Mauro Talevi added a comment - I agree that story should be a separate model concept. The issue here is that we started with the Scenario concept and then added the ability to run multiple scenarios, which in my mind constitutes a story. So I would only run a story (ie a set of scenarios) to set up a context for another story - that's why I was thinking of calling it GivenStory. I think this could be retrofitted in 2.x codebase, possibly. Else we could branch off a 3.x and revisit the whole model to be more story-aware. The alternative of keeping the GivenScenario as a context set up for each scenario is possible, but complicates the parsing IMO in case you had multiple GivenScenario in a single file. We need to evaluate which of the two use cases is more used. I'm thinking that most likely users would need a single setup call for all the scenarios in their file.
        Hide
        Mauro Talevi added a comment -

        Bumping out of 2.2 release until consensus is reached on how to approach problem.

        Show
        Mauro Talevi added a comment - Bumping out of 2.2 release until consensus is reached on how to approach problem.
        Mauro Talevi made changes -
        Fix Version/s 2.3 [ 14941 ]
        Fix Version/s 2.2 [ 14670 ]
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Joseph Wilk added a comment -

        Just spotted this ticket and I thought I would chime in with how in Cucumber (http://wiki.github.com/aslakhellesoy/cucumber) we introduced GivenScenario and relatively swiftly decided to remove the feature in favour of other solutions.

        I noted down some of the reasons why we removed it and what replaced it: http://blog.josephwilk.net/ruby/cucumber-waves-goodbye-to-givenscenario.html

        Hope that might be of some relevance and help.

        Show
        Joseph Wilk added a comment - Just spotted this ticket and I thought I would chime in with how in Cucumber ( http://wiki.github.com/aslakhellesoy/cucumber ) we introduced GivenScenario and relatively swiftly decided to remove the feature in favour of other solutions. I noted down some of the reasons why we removed it and what replaced it: http://blog.josephwilk.net/ruby/cucumber-waves-goodbye-to-givenscenario.html Hope that might be of some relevance and help.
        Hide
        Mauro Talevi added a comment -

        Thanks for your comments - interesting post.

        The use case for GivenScenarios is still quite valid IMO - but it addresses a different concern from what you describe in your post, i.e. it's not about calling a scenario from another within the same feature. Rather it's about using a different story or feature as a pre-condition for a scenario. It's not meant to be called before each scenario (like background). You could debate whether it should be called GivenStory or GivenFeature but it does not change the substance of the matter.

        This feature allows scenarios (or features) to have less repetition and be structured in a more modular and reusable way, without enforcing an order on the scenarios being run (e.g. by scenario file name). Experience in working with hundreds of scenarios has shown us how useful this feature can be, and it has been one of the most highly requested features I received as feedback. It is particularly useful when running in an IDE.

        Show
        Mauro Talevi added a comment - Thanks for your comments - interesting post. The use case for GivenScenarios is still quite valid IMO - but it addresses a different concern from what you describe in your post, i.e. it's not about calling a scenario from another within the same feature. Rather it's about using a different story or feature as a pre-condition for a scenario. It's not meant to be called before each scenario (like background). You could debate whether it should be called GivenStory or GivenFeature but it does not change the substance of the matter. This feature allows scenarios (or features) to have less repetition and be structured in a more modular and reusable way, without enforcing an order on the scenarios being run (e.g. by scenario file name). Experience in working with hundreds of scenarios has shown us how useful this feature can be, and it has been one of the most highly requested features I received as feedback. It is particularly useful when running in an IDE.
        Hide
        Mauro Talevi added a comment -

        Added GivenScenarios: keyword which expects a CSV of scenario file paths as part of a scenario:

        Scenario: A scenario with given scenarios as preconditions

        GivenScenarios: path/to/scenario1, path/to/scenario2

        Given ...
        When ...
        Then ...

        Note that the GivenScenarios: must come before first Given/When/Then

        Upon presence of given scenario paths, it will execute any scenario(s) contained in them before executing the steps of the scenaio.

        Show
        Mauro Talevi added a comment - Added GivenScenarios: keyword which expects a CSV of scenario file paths as part of a scenario: Scenario: A scenario with given scenarios as preconditions GivenScenarios: path/to/scenario1, path/to/scenario2 Given ... When ... Then ... Note that the GivenScenarios: must come before first Given/When/Then Upon presence of given scenario paths, it will execute any scenario(s) contained in them before executing the steps of the scenaio.
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Elizabeth Keogh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: