vendredi 9 novembre 2018

Is there a way to avoid duplicate Cucumber scenarios with different backgrounds?

We're starting to use cucumber (Java) and really liking it but Cucumber seems to completely fail at a very important case:

Basically I have a scenario that runs for a given logged in user, I need to literally run all the same tests with a different type of logged in user.

Then after that I need to run most of the exact same scenarios with a user logged in with a different role (multiple roles with overlapping authority)

This would be clean and trivial with a Background outline functionality, but that seems to have been denied years ago ( https://github.com/cucumber-attic/gherkin/issues/56)

I know this has been asked before but I keep turning up very old threads (some 6 years old!) with no answer other than "duplicate all your scenarios".

Duplicating hundreds of Scenarios is a failure on every front, it makes the test base unmanageable (a change in one scenario needs to propagate to multiple duplicates) . It fails in the core communication goal of cucumber as we get a huge bloat of feature files making it harder to know what the app is doing and what we're testing.

in the 6 years since the first complaints is there any reasonable way to manage this?

at this point I'm tempted to remove the background and move it into each scenario and use scenario outlines, it's ugly and the tests no longer read as cleanly but at least I don't need to duplicate scenarios.

Aucun commentaire:

Enregistrer un commentaire