diff --git a/internal/formatters/fmt_output_test.go b/internal/formatters/fmt_output_test.go index 5a9d689e..423558da 100644 --- a/internal/formatters/fmt_output_test.go +++ b/internal/formatters/fmt_output_test.go @@ -25,7 +25,7 @@ func Test_FmtOutput(t *testing.T) { featureFiles, err := listFmtOutputTestsFeatureFiles() require.Nil(t, err) - formatters := []string{"cucumber", "events", "junit", "pretty", "progress"} + formatters := []string{"cucumber", "events", "junit", "pretty", "progress", "junit,pretty"} for _, fmtName := range formatters { for _, featureFile := range featureFiles { diff --git a/internal/formatters/formatter-tests/junit,pretty/empty b/internal/formatters/formatter-tests/junit,pretty/empty new file mode 100644 index 00000000..d2d5f6b8 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/empty @@ -0,0 +1,5 @@ + + +No scenarios +No steps +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/empty_with_description b/internal/formatters/formatter-tests/junit,pretty/empty_with_description new file mode 100644 index 00000000..d2d5f6b8 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/empty_with_description @@ -0,0 +1,5 @@ + + +No scenarios +No steps +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/empty_with_single_scenario_without_steps b/internal/formatters/formatter-tests/junit,pretty/empty_with_single_scenario_without_steps new file mode 100644 index 00000000..345c16a1 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/empty_with_single_scenario_without_steps @@ -0,0 +1,12 @@ +Feature: empty feature + + Scenario: without steps # formatter-tests/features/empty_with_single_scenario_without_steps.feature:3 + + + + + + +1 scenarios (1 undefined) +No steps +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/empty_with_single_scenario_without_steps_and_description b/internal/formatters/formatter-tests/junit,pretty/empty_with_single_scenario_without_steps_and_description new file mode 100644 index 00000000..9abc701b --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/empty_with_single_scenario_without_steps_and_description @@ -0,0 +1,15 @@ +Feature: empty feature + describes + an empty + feature + + Scenario: without steps # formatter-tests/features/empty_with_single_scenario_without_steps_and_description.feature:6 + + + + + + +1 scenarios (1 undefined) +No steps +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/scenario_outline b/internal/formatters/formatter-tests/junit,pretty/scenario_outline new file mode 100644 index 00000000..1f1f92d6 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/scenario_outline @@ -0,0 +1,54 @@ +Feature: outline + + Scenario Outline: outline # formatter-tests/features/scenario_outline.feature:5 + Given passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + When passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + Then odd and even number # fmt_output_test.go:103 -> github.com/cucumber/godog/internal/formatters_test.oddEvenStepDef + + Examples: tagged + | odd | even | + | 1 | 2 | + | 2 | 0 | + 2 is not odd + | 3 | 11 | + 11 is not even + + Examples: + | odd | even | + | 1 | 14 | + | 3 | 9 | + 9 is not even + + + + + + + + + + + + + + + + +--- Failed steps: + + Scenario Outline: outline # formatter-tests/features/scenario_outline.feature:5 + Then odd 2 and even 0 number # formatter-tests/features/scenario_outline.feature:8 + Error: 2 is not odd + + Scenario Outline: outline # formatter-tests/features/scenario_outline.feature:5 + Then odd 3 and even 11 number # formatter-tests/features/scenario_outline.feature:8 + Error: 11 is not even + + Scenario Outline: outline # formatter-tests/features/scenario_outline.feature:5 + Then odd 3 and even 9 number # formatter-tests/features/scenario_outline.feature:8 + Error: 9 is not even + + +5 scenarios (2 passed, 3 failed) +15 steps (12 passed, 3 failed) +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/scenario_with_background b/internal/formatters/formatter-tests/junit,pretty/scenario_with_background new file mode 100644 index 00000000..44cb82fd --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/scenario_with_background @@ -0,0 +1,18 @@ +Feature: single scenario with background + + Background: named + Given passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + And passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + Scenario: scenario # formatter-tests/features/scenario_with_background.feature:7 + When passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + Then passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + + + + + +1 scenarios (1 passed) +4 steps (4 passed) +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/scenario_without_steps_with_background b/internal/formatters/formatter-tests/junit,pretty/scenario_without_steps_with_background new file mode 100644 index 00000000..410b1532 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/scenario_without_steps_with_background @@ -0,0 +1,15 @@ +Feature: empty feature + + Background: + Given passing step + + Scenario: without steps # formatter-tests/features/scenario_without_steps_with_background.feature:6 + + + + + + +1 scenarios (1 undefined) +No steps +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/single_scenario_with_passing_step b/internal/formatters/formatter-tests/junit,pretty/single_scenario_with_passing_step new file mode 100644 index 00000000..dd33ade1 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/single_scenario_with_passing_step @@ -0,0 +1,16 @@ +Feature: single passing scenario + describes + a single scenario + feature + + Scenario: one step passing # formatter-tests/features/single_scenario_with_passing_step.feature:6 + Given a passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + + + + + +1 scenarios (1 passed) +1 steps (1 passed) +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/some_scenarions_including_failing b/internal/formatters/formatter-tests/junit,pretty/some_scenarions_including_failing new file mode 100644 index 00000000..45670953 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/some_scenarions_including_failing @@ -0,0 +1,54 @@ +Feature: some scenarios + + Scenario: failing # formatter-tests/features/some_scenarions_including_failing.feature:3 + Given passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + When failing step # fmt_output_test.go:117 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef + step failed + Then passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + Scenario: pending # formatter-tests/features/some_scenarions_including_failing.feature:8 + When pending step # fmt_output_test.go:115 -> github.com/cucumber/godog/internal/formatters_test.pendingStepDef + TODO: write pending definition + Then passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + Scenario: undefined # formatter-tests/features/some_scenarions_including_failing.feature:12 + When undefined + Then passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + + + + + + + + + + + + + + + + +--- Failed steps: + + Scenario: failing # formatter-tests/features/some_scenarions_including_failing.feature:3 + When failing step # formatter-tests/features/some_scenarions_including_failing.feature:5 + Error: step failed + + +3 scenarios (1 failed, 1 pending, 1 undefined) +7 steps (1 passed, 1 failed, 1 pending, 1 undefined, 3 skipped) +0s + +You can implement step definitions for undefined steps with these snippets: + +func undefined() error { + return godog.ErrPending +} + +func InitializeScenario(ctx *godog.ScenarioContext) { + ctx.Step(`^undefined$`, undefined) +} + diff --git a/internal/formatters/formatter-tests/junit,pretty/two_scenarios_with_background_fail b/internal/formatters/formatter-tests/junit,pretty/two_scenarios_with_background_fail new file mode 100644 index 00000000..995dec62 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/two_scenarios_with_background_fail @@ -0,0 +1,41 @@ +Feature: two scenarios with background fail + + Background: + Given passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + And failing step # fmt_output_test.go:117 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef + step failed + + Scenario: one # formatter-tests/features/two_scenarios_with_background_fail.feature:7 + When passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + Then passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + Scenario: two # formatter-tests/features/two_scenarios_with_background_fail.feature:11 + Then passing step # fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef + + + + + + + + + + + + + + +--- Failed steps: + + Scenario: one # formatter-tests/features/two_scenarios_with_background_fail.feature:7 + And failing step # formatter-tests/features/two_scenarios_with_background_fail.feature:5 + Error: step failed + + Scenario: two # formatter-tests/features/two_scenarios_with_background_fail.feature:11 + And failing step # formatter-tests/features/two_scenarios_with_background_fail.feature:5 + Error: step failed + + +2 scenarios (2 failed) +7 steps (2 passed, 2 failed, 3 skipped) +0s diff --git a/internal/formatters/formatter-tests/junit,pretty/with_few_empty_scenarios b/internal/formatters/formatter-tests/junit,pretty/with_few_empty_scenarios new file mode 100644 index 00000000..752f37e6 --- /dev/null +++ b/internal/formatters/formatter-tests/junit,pretty/with_few_empty_scenarios @@ -0,0 +1,29 @@ +Feature: few empty scenarios + + Scenario: one # formatter-tests/features/with_few_empty_scenarios.feature:3 + + Scenario Outline: two # formatter-tests/features/with_few_empty_scenarios.feature:5 + + Examples: first group + | one | two | + | 1 | 2 | + | 4 | 7 | + + Examples: second group + | one | two | + | 5 | 9 | + + Scenario: three # formatter-tests/features/with_few_empty_scenarios.feature:16 + + + + + + + + + + +5 scenarios (5 undefined) +No steps +0s