cucumber / godog

Cucumber for golang
MIT License
2.21k stars 249 forks source link

Unexpected step line values in cucumber report generated by Godog for scenario outlines #604

Closed katyaaronov closed 3 months ago

katyaaronov commented 3 months ago

Discussed in https://github.com/cucumber/godog/discussions/603

Originally posted by **katyaaronov** January 24, 2024 The below code from cucumber/godog/fmt_cucumber.go overwrites the line property values of steps in cucumber reports (for Scenario Outlines only, regular Scenarios reports look good). As a result, the step line property corresponds to the line in the Examples section rather than to the actual location of step within the feature file. Due to the above, external tools that process the reports and use the line property for sorting the steps, display the steps out of order. Other officially supported cucumber implementations (java, js, python, etc.) are generating reports correctly for Scenario Outline - line property corresponds to the actual location of step within the file rather than the line in Examples section. Please advice. Regards, Katya. ``` func (f *Cuke) buildCukeStep(pickle *messages.Pickle, stepResult models.PickleStepResult) (cukeStep cukeStep) { ... line := step.Location.Line if len(pickle.AstNodeIds) == 2 { _, row := feature.FindExample(pickle.AstNodeIds[1]) line = row.Location.Line } ... cukeStep.Line = int(line) ... } ```