Skip to content

Need I really to define each Scenario with its dependent steps outside of the feature file ? #52

@pedrowilkens

Description

@pedrowilkens

As im working with jest-cucumber for some time, i was asking myself if it is really usefull if i need to allways define the scenarios and its related steps in defineFeature callback because that leads to duplicated code.

If i want to avoid this i need a hack like this:

         const feature = loadFeature(featureFile, tagFilter)

         defineFeature(feature, test => {
             feature.scenarios.forEach((scenario) => {
                test(scenario.title, (stepName) => {
                    scenario.steps.forEach((step) => {
                        stepName[step.keyword](step.stepText, Steps.get(step.stepText))
                    })
                })
            })
        })

Is my understanding correct ? Because every Scenario must be defined with its steps, i need to define them more then once.. ?

If there is another way and i am wrong, i would be very happy to know about it

Btw im reading your source code, because im working on cucumbers "Background" problem. Since its not implemented yet, everyone just uses beforeEach instead right?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions