Add suite_test.go back
Этот коммит содержится в:
родитель
88bd160759
коммит
cc861097ae
3 изменённых файлов: 55 добавлений и 1 удалений
6
go.mod
6
go.mod
|
@ -2,4 +2,8 @@ module github.com/cucumber/godog
|
|||
|
||||
go 1.13
|
||||
|
||||
require github.com/stretchr/testify v1.4.0
|
||||
require (
|
||||
github.com/DATA-DOG/go-txdb v0.1.3
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/stretchr/testify v1.4.0
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,9 @@
|
|||
github.com/DATA-DOG/go-txdb v0.1.3 h1:R4v6OuOcy2O147e2zHxU0B4NDtF+INb5R9q/CV7AEMg=
|
||||
github.com/DATA-DOG/go-txdb v0.1.3/go.mod h1:DhAhxMXZpUJVGnT+p9IbzJoRKvlArO2pkHjnGX7o0n0=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
|
46
suite_test.go
Обычный файл
46
suite_test.go
Обычный файл
|
@ -0,0 +1,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)
|
||||
}
|
Загрузка…
Создание таблицы
Сослаться в новой задаче