forked from cucumber/godog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuite_test.go
46 lines (41 loc) · 959 Bytes
/
suite_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
package godog
import (
"os"
"strings"
"testing"
"time"
)
func TestMain(m *testing.M) {
format := "progress" // non verbose mode
concurrency := 4
var specific bool
for _, arg := range os.Args[1:] {
if arg == "-test.v=true" { // go test transforms -v option - verbose mode
format = "pretty"
concurrency = 1
break
}
if strings.Index(arg, "-test.run") == 0 {
specific = true
}
}
var status int
if !specific {
status = RunWithOptions("godog", func(s *Suite) {
GodogContext(s)
}, Options{
Format: format, // pretty format for verbose mode, otherwise - progress
Paths: []string{"features"},
Concurrency: concurrency, // concurrency for verbose mode is 1
Randomize: time.Now().UnixNano(), // randomize scenario execution order
})
}
if st := m.Run(); st > status {
status = st
}
os.Exit(status)
}
// needed in order to use godog cli
func GodogContext(s *Suite) {
SuiteContext(s)
}