/
main_test.go
49 lines (45 loc) · 1.12 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main_test
import (
"os"
"runtime"
"testing"
"github.com/cucumber/godog"
"github.com/git-town/git-town/v14/test/cucumber"
)
func FeatureContext(suite *godog.Suite) {
// The current Godog implementation only provides a FeatureContext,
// no SuiteContext nor ScenarioContext.
// Hence we have to register the scenario state here (and reuse it for all scenarios in a feature)
// and register the steps here.
// It is initialized in SuiteSteps.BeforeScenario.
state := cucumber.ScenarioState{}
cucumber.Steps(suite, &state)
}
//nolint:paralleltest
func TestGodog(t *testing.T) {
tags := ""
var concurrency int
if runtime.GOOS == "windows" {
tags = "~@skipWindows"
concurrency = 1
} else {
concurrency = 4
}
if os.Getenv("smoke") != "" {
tags = "@smoke"
}
if os.Getenv("cukethis") != "" {
tags = "@this"
}
status := godog.RunWithOptions("godog", FeatureContext, godog.Options{
Format: "progress",
Concurrency: runtime.NumCPU() * concurrency,
StopOnFailure: true,
Strict: true,
Paths: []string{"features/"},
Tags: tags,
})
if status > 0 {
t.FailNow()
}
}