b-yond-infinite-network / jest-cucumber-fusion

Write cucumber test the natural way but still have them part of a jest run (including coverage)
Apache License 2.0
15 stars 8 forks source link

[Request] Outline Scenario Title Variables #13

Open dizzyn opened 4 years ago

dizzyn commented 4 years ago

Hi, thank you for the great library. Could you please add real values into the log messages of the outline scenarios?

Feature File: Screenshot 2020-07-15 at 09 57 26

Log: image

Thank You

bruno-morel commented 4 years ago

Ah. Interesting. I have the same frustration than you...:)

This unfortunately is a jest-cucumber error that is raised and that your runner is displaying...

The trick is, jest-cucumber-fusion register the Scenario outline as a parameterized title within jest-cucumber to avoid jest detecting the same title more than once "Error: More than one scenario found in step definitions matching scenario title """ which is breaking... This mechanism is powerful in the sense where it allows jest-cucumber to use the regexp version of the different steps instead of having to run each regexp against each scenario...

I did try to force jest-cucumber to use the "expanded" outlines (with the variable replaced by real values) by iterating through all the scenario manually one by one. Unfortunatly, jest-cucumber end up trying to protect us from that with no matching "Feature" (aka same title in the gherkin file). The error would be at that point "No scenarios found in feature file that match scenario title ".

So if we want this to be possible (and I agree it would be better...), we'll have to convince the author of jest-cucumber to change his error handling ....https://github.com/bencompton/jest-cucumber Especially, I do believe that the https://github.com/bencompton/jest-cucumber/blob/master/src/validation/scenario-validation.ts can be allowed to be a bit flexible, or a failing scenario to raise it's expanded name and not the generic one...

I'll support and help explain if you feel it's worth going for...