From 32feb1d1cc2d1a63348ccbb834db08705e1d977a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnblad?= Date: Mon, 20 Jan 2020 14:55:27 -0300 Subject: [PATCH] Added testcase for Junit in concurrent mode --- run_test.go | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/run_test.go b/run_test.go index c79aff9..ffbc241 100644 --- a/run_test.go +++ b/run_test.go @@ -276,7 +276,7 @@ func TestFeatureFilePathParser(t *testing.T) { } } -func TestSucceedWithConcurrencyOption(t *testing.T) { +func TestSucceedWithProgressAndConcurrencyOption(t *testing.T) { output := new(bytes.Buffer) opt := Options{ @@ -312,3 +312,116 @@ func TestSucceedWithConcurrencyOption(t *testing.T) { t.Fatalf("unexpected output: \"%s\"", out) } } + +func TestSucceedWithJunitAndConcurrencyOption(t *testing.T) { + output := new(bytes.Buffer) + + opt := Options{ + Format: "junit", + NoColors: true, + Paths: []string{"features"}, + Concurrency: 2, + Output: output, + } + + expectedOutput := ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +` + + status := RunWithOptions("succeed", func(s *Suite) { SuiteContext(s) }, opt) + if status != exitSuccess { + t.Fatalf("expected exit status to be 0, but was: %d", status) + } + + b, err := ioutil.ReadAll(output) + if err != nil { + t.Fatal(err) + } + + out := strings.TrimSpace(string(b)) + if out != expectedOutput { + t.Fatalf("unexpected output: \"%s\"", out) + } +}