cucumber-junit icon indicating copy to clipboard operation
cucumber-junit copied to clipboard

Scenario as single testcase, rather than Given/When/Then

Open rafaelcichocki opened this issue 7 years ago • 7 comments

image

I don't know if this is intended or not. Basically, each step (Given/When/Then/And) component of a scenario is counted as a testcase. I would prefer each scenario within a feature to be treated as a testcase. The reason being, that I re-use each Given, When and Then often, which in the report artificially increases the actual test count.

Do you think this would be a reasonable change (I would try to implement it)? Or is this an optional feature?

rafaelcichocki avatar Oct 05 '16 12:10 rafaelcichocki

Well the output from Cucumber contains timing and status for each step, so I felt that would be the best translation. There is no overall scenario status or timing, so you would have to assemble it from the step data.

I'm not opposed to this, I would just want to see it as an option. Something like --scope=scenario default to step

stjohnjohnson avatar Oct 08 '16 03:10 stjohnjohnson

Sample cucumber json for you: https://github.com/stjohnjohnson/cucumber-junit/blob/a5d7aff1da03e01c7ef15141cdf1dadbf62026be/tests/mocks/input.json

stjohnjohnson avatar Oct 08 '16 03:10 stjohnjohnson

This reporter handles it like I suggested: https://github.com/davidparsson/junit-report-builder

rafaelcichocki avatar Oct 14 '16 11:10 rafaelcichocki

Actually, the cucumber junit reporter in other languages works like rafaelcichocki describes

fmarmar avatar Jun 26 '17 13:06 fmarmar

I vote for this. TestCase == Scenario, not step. Time should be sum up for all step in scenario. This is the most wanted way, I even do it be default and make parameter for TC == Step.

Thanks!

znevrly avatar Feb 19 '18 15:02 znevrly

@znevrly like I said, if you want to give a PR to add this feature, I'm all for it (but please make it optional, we can make it default eventually).

stjohnjohnson avatar Feb 19 '18 18:02 stjohnjohnson

Sorry, but code it's unnecessary complex. Why involve XML when there is JUnit builder. I have made very simple implementation https://www.npmjs.com/package/cucumber-junit-convert

znevrly avatar Aug 02 '18 20:08 znevrly