From dcf5173b0fed115d4aab2d1da22c540f8a9656bd Mon Sep 17 00:00:00 2001 From: Devin Gunay Date: Thu, 22 Aug 2024 11:31:51 -0700 Subject: [PATCH 1/2] Actually set `parallel` to true by default --- runner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner.go b/runner.go index 06dc1b4..2795328 100644 --- a/runner.go +++ b/runner.go @@ -59,7 +59,7 @@ func NewRunner(t *testing.T, suiteType interface{}) *Runner { r := &Runner{ topLevelT: t, incr: &messages.Incrementing{}, - parallel: false, + parallel: true, haveSuggestion: map[string]bool{}, supportedSpecialArgs: map[reflect.Type]specialArgGetter{ // TestingT From 737245d8f13e9aeed1d25bf00e9cb285e76f09b1 Mon Sep 17 00:00:00 2001 From: Devin Gunay Date: Thu, 22 Aug 2024 20:53:11 -0700 Subject: [PATCH 2/2] Mark a few tests as NonParallel --- examples/api/api_test.go | 4 +++- hooks_test.go | 11 +++++++---- simple_test.go | 6 +++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/examples/api/api_test.go b/examples/api/api_test.go index d255081..1008209 100644 --- a/examples/api/api_test.go +++ b/examples/api/api_test.go @@ -20,7 +20,9 @@ type suite struct { func TestApi(t *testing.T) { scope := &suite{TestingT: t, resp: httptest.NewRecorder()} - run := gocuke.NewRunner(t, scope) + run := gocuke. + NewRunner(t, scope). + NonParallel() run.Before(func() { scope.resp = httptest.NewRecorder() }) diff --git a/hooks_test.go b/hooks_test.go index 2d776b3..272e5d2 100644 --- a/hooks_test.go +++ b/hooks_test.go @@ -14,6 +14,7 @@ func TestHooks(t *testing.T) { NewRunner(t, &hooksSuite{}). Path("features/hooks.feature"). Tags("@long"). + NonParallel(). Run() assert.Assert(t, longRun) assert.Assert(t, !shortRun) @@ -25,6 +26,7 @@ func TestHooks(t *testing.T) { NewRunner(t, &hooksSuite{}). Path("features/hooks.feature"). ShortTags("not @long"). + NonParallel(). Run() assert.Assert(t, longRun) @@ -33,12 +35,13 @@ func TestHooks(t *testing.T) { if open != 0 { t.Fatalf("expected 0 open resources, got: %d", open) } - } -var longRun = false -var shortRun = false -var open int64 = 0 +var ( + longRun = false + shortRun = false + open int64 = 0 +) type hooksSuite struct { TestingT diff --git a/simple_test.go b/simple_test.go index 0f90a53..97b0b31 100644 --- a/simple_test.go +++ b/simple_test.go @@ -31,7 +31,11 @@ func (s *simpleSuite) IHaveLeft(a int64) { // test if a struct that doesn't use a pointer and a global var func TestSimpleNonPointer(t *testing.T) { - gocuke.NewRunner(t, simpleSuiteNP{}).Path("examples/simple/simple.feature").Run() + gocuke. + NewRunner(t, simpleSuiteNP{}). + Path("examples/simple/simple.feature"). + NonParallel(). + Run() } var globalCukes int64