How to generate results from a Ruby Cucumber Scenario Outline that can be properly consumed by cucumber-reporting?

StackOverflow https://stackoverflow.com/questions/19103755

Question

We have an app using Cucumber with many gherkins that use Scenario Outlines. We are using ruby to run the tests.

I'd like to display the results of these tests with cucumber-reporting. However, there is currently an issue with how cucumber reports JSON (et al) results for Scenario Outlines, which means that the output does not contain proper results and the report cannot display those results. See this issue and this issue.

Can I put in a hack to Cucumber to make JSON report properly when dealing with Scenario Outlines? Alternately, is there an automated way to process the Scenario Outlines into normal Scenarios so that Cucumber will generate proper reports?

Below I have a brute-force answer, but I would appreciate something less kludgy.

Was it helpful?

Solution

Note: I really don't like this answer.

Scenario Outlines can be preprocessed using cucumber -f pretty -x -d, which expands scenario outlines in a dry-run, where the steps are not actually executed. The output can be piped to a file and that file can be chopped up using some script to extract the generated scenarios.

Those scenarios can then be included in the input to the actual cucumber execution, which will execute the Scenario Outlines as if they are normal Scenarios.

This is really kludgy and would require writing a script to chop up the results of the -f pretty -x output (including removing the auto-comments on each line and the preamble to the actual generated Examples: for each outline).

Update:

Someone has written a formatter that essentially does this, but they warn that it's a hack: https://gist.github.com/blt04/9866357

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top