diff --git a/fmt.go b/fmt.go index 5a92fbf..6282883 100644 --- a/fmt.go +++ b/fmt.go @@ -321,6 +321,7 @@ func (f *basefmt) Summary() { } } } + passed = total - undefined var owner interface{} for _, undef := range f.undefined { if owner != undef.owner { @@ -328,7 +329,6 @@ func (f *basefmt) Summary() { owner = undef.owner } } - passed = total - undefined var steps, parts, scenarios []string nsteps := len(f.passed) + len(f.failed) + len(f.skipped) + len(f.undefined) + len(f.pending) diff --git a/fmt_progress_test.go b/fmt_progress_test.go index e55983d..5aa0afc 100644 --- a/fmt_progress_test.go +++ b/fmt_progress_test.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io/ioutil" - "os" "strings" "testing" "time" @@ -54,8 +53,6 @@ func TestProgressFormatterOutput(t *testing.T) { 23 steps (14 passed, 2 failed, 2 pending, 3 undefined, 2 skipped) %s -Randomized with seed: %s - You can implement step definitions for undefined steps with these snippets: func undefined() error { @@ -72,7 +69,7 @@ func FeatureContext(s *godog.Suite) { }` var zeroDuration time.Duration - expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED")) + expected = fmt.Sprintf(expected, zeroDuration.String()) expected = trimAllLines(expected) r.run() @@ -120,7 +117,7 @@ func TestProgressFormatterWhenStepPanics(t *testing.T) { } out := buf.String() - if idx := strings.Index(out, "github.com/DATA-DOG/godog/fmt_progress_test.go:114"); idx == -1 { + if idx := strings.Index(out, "github.com/DATA-DOG/godog/fmt_progress_test.go:111"); idx == -1 { t.Fatalf("expected to find panic stacktrace, actual:\n%s", out) } } @@ -188,13 +185,11 @@ Error: sub2: sub-sub: errored 1 scenarios (1 failed) 2 steps (1 passed, 1 failed) %s - -Randomized with seed: %s ` expected = trimAllLines(expected) var zeroDuration time.Duration - expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED")) + expected = fmt.Sprintf(expected, zeroDuration.String()) actual := trimAllLines(buf.String()) shouldMatchOutput(expected, actual, t) @@ -283,8 +278,6 @@ func TestProgressFormatterMultistepTemplates(t *testing.T) { 2 steps (1 passed, 1 undefined) %s -Randomized with seed: %s - You can implement step definitions for undefined steps with these snippets: func undef() error { @@ -307,7 +300,7 @@ func FeatureContext(s *godog.Suite) { ` var zeroDuration time.Duration - expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED")) + expected = fmt.Sprintf(expected, zeroDuration.String()) expected = trimAllLines(expected) actual := trimAllLines(buf.String()) @@ -396,12 +389,10 @@ Feature: basic 1 scenarios (1 failed) 2 steps (1 passed, 1 failed) %s - -Randomized with seed: %s ` var zeroDuration time.Duration - expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED")) + expected = fmt.Sprintf(expected, zeroDuration.String()) expected = trimAllLines(expected) actual := trimAllLines(buf.String()) diff --git a/formatter-tests/pretty/single_scenario_with_passing_step b/formatter-tests/pretty/single_scenario_with_passing_step index e0dcf32..23fc002 100644 --- a/formatter-tests/pretty/single_scenario_with_passing_step +++ b/formatter-tests/pretty/single_scenario_with_passing_step @@ -4,7 +4,7 @@ feature Scenario: one step passing # formatter-tests/features/single_scenario_with_passing_step.feature:6 - Given a passing step # formatters_print_test.go:35 -> github.com/DATA-DOG/godog.TestPrintingFormatters.func4 + Given a passing step # formatters_print_test.go:34 -> github.com/DATA-DOG/godog.TestPrintingFormatters.func4 1 scenarios (1 passed) 1 steps (1 passed) diff --git a/run.go b/run.go index 22d3956..fcd70f7 100644 --- a/run.go +++ b/run.go @@ -166,6 +166,10 @@ func RunWithOptions(suite string, contextInitializer func(suite *Suite), opt Opt } else { failed = r.run() } + + // @TODO: should prevent from having these + os.Setenv("GODOG_SEED", "") + os.Setenv("GODOG_TESTED_PACKAGE", "") if failed && opt.Format != "events" { return exitFailure }