Merge pull request #295 from cucumber/formatter-test-lookover
Moved fmt tests to a godog_test pkg and restructured the fmt output tests
Этот коммит содержится в:
коммит
b0f295dc28
23 изменённых файлов: 261 добавлений и 496 удалений
|
@ -37,6 +37,7 @@ commands:
|
|||
go_test:
|
||||
description: "Run go test"
|
||||
steps:
|
||||
- run: sed -i 's#github.com/cucumber/godog_test#_test#g' formatter-tests/*/*
|
||||
- run: go test -v -race -coverprofile=coverage.txt -covermode=atomic
|
||||
godog:
|
||||
description: "Run godog"
|
||||
|
@ -67,7 +68,6 @@ commands:
|
|||
- part1
|
||||
- part2
|
||||
|
||||
|
||||
jobs:
|
||||
go1_12:
|
||||
working_directory: /go/src/github.com/cucumber/godog
|
||||
|
|
5
fmt.go
5
fmt.go
|
@ -19,8 +19,8 @@ import (
|
|||
|
||||
type registeredFormatter struct {
|
||||
name string
|
||||
fmt FormatterFunc
|
||||
description string
|
||||
fmt FormatterFunc
|
||||
}
|
||||
|
||||
var formatters []*registeredFormatter
|
||||
|
@ -34,6 +34,7 @@ func FindFmt(name string) FormatterFunc {
|
|||
return el.fmt
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -54,9 +55,11 @@ func Format(name, description string, f FormatterFunc) {
|
|||
// and description as value
|
||||
func AvailableFormatters() map[string]string {
|
||||
fmts := make(map[string]string, len(formatters))
|
||||
|
||||
for _, f := range formatters {
|
||||
fmts[f.name] = f.description
|
||||
}
|
||||
|
||||
return fmts
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package godog
|
||||
package godog_test
|
||||
|
||||
import (
|
||||
"bytes"
|
|
@ -1,176 +0,0 @@
|
|||
package godog
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/cucumber/gherkin-go/v11"
|
||||
"github.com/cucumber/messages-go/v10"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cucumber/godog/colors"
|
||||
)
|
||||
|
||||
var sampleGherkinFeature = `
|
||||
Feature: junit formatter
|
||||
|
||||
Background:
|
||||
Given passing
|
||||
|
||||
Scenario: passing scenario
|
||||
Then passing
|
||||
|
||||
Scenario: failing scenario
|
||||
When failing
|
||||
Then passing
|
||||
|
||||
Scenario: pending scenario
|
||||
When pending
|
||||
Then passing
|
||||
|
||||
Scenario: undefined scenario
|
||||
When undefined
|
||||
Then next undefined
|
||||
|
||||
Scenario Outline: outline
|
||||
Given <one>
|
||||
When <two>
|
||||
|
||||
Examples:
|
||||
| one | two |
|
||||
| passing | passing |
|
||||
| passing | failing |
|
||||
| passing | pending |
|
||||
|
||||
Examples:
|
||||
| one | two |
|
||||
| passing | undefined |
|
||||
`
|
||||
|
||||
func TestJUnitFormatterOutput(t *testing.T) {
|
||||
const path = "any.feature"
|
||||
|
||||
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(sampleGherkinFeature), (&messages.Incrementing{}).NewId)
|
||||
require.NoError(t, err)
|
||||
|
||||
pickles := gherkin.Pickles(*gd, path, (&messages.Incrementing{}).NewId)
|
||||
|
||||
var buf bytes.Buffer
|
||||
w := colors.Uncolored(&buf)
|
||||
s := &Suite{
|
||||
fmt: junitFunc("junit", w),
|
||||
features: []*feature{{
|
||||
GherkinDocument: gd,
|
||||
pickles: pickles,
|
||||
Path: path,
|
||||
Content: []byte(sampleGherkinFeature),
|
||||
}},
|
||||
}
|
||||
|
||||
s.Step(`^passing$`, func() error { return nil })
|
||||
s.Step(`^failing$`, func() error { return fmt.Errorf("errored") })
|
||||
s.Step(`^pending$`, func() error { return ErrPending })
|
||||
|
||||
const zeroDuration = "0"
|
||||
expected := junitPackageSuite{
|
||||
Name: "junit",
|
||||
Tests: 8,
|
||||
Skipped: 0,
|
||||
Failures: 2,
|
||||
Errors: 4,
|
||||
Time: zeroDuration,
|
||||
TestSuites: []*junitTestSuite{{
|
||||
Name: "junit formatter",
|
||||
Tests: 8,
|
||||
Skipped: 0,
|
||||
Failures: 2,
|
||||
Errors: 4,
|
||||
Time: zeroDuration,
|
||||
TestCases: []*junitTestCase{
|
||||
{
|
||||
Name: "passing scenario",
|
||||
Status: "passed",
|
||||
Time: zeroDuration,
|
||||
},
|
||||
{
|
||||
Name: "failing scenario",
|
||||
Status: "failed",
|
||||
Time: zeroDuration,
|
||||
Failure: &junitFailure{
|
||||
Message: "Step failing: errored",
|
||||
},
|
||||
Error: []*junitError{
|
||||
{Message: "Step passing", Type: "skipped"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "pending scenario",
|
||||
Status: "pending",
|
||||
Time: zeroDuration,
|
||||
Error: []*junitError{
|
||||
{Message: "Step pending: TODO: write pending definition", Type: "pending"},
|
||||
{Message: "Step passing", Type: "skipped"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "undefined scenario",
|
||||
Status: "undefined",
|
||||
Time: zeroDuration,
|
||||
Error: []*junitError{
|
||||
{Message: "Step undefined", Type: "undefined"},
|
||||
{Message: "Step next undefined", Type: "undefined"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "outline #1",
|
||||
Status: "passed",
|
||||
Time: zeroDuration,
|
||||
},
|
||||
{
|
||||
Name: "outline #2",
|
||||
Status: "failed",
|
||||
Time: zeroDuration,
|
||||
Failure: &junitFailure{
|
||||
Message: "Step failing: errored",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "outline #3",
|
||||
Status: "pending",
|
||||
Time: zeroDuration,
|
||||
Error: []*junitError{
|
||||
{Message: "Step pending: TODO: write pending definition", Type: "pending"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "outline #4",
|
||||
Status: "undefined",
|
||||
Time: zeroDuration,
|
||||
Error: []*junitError{
|
||||
{Message: "Step undefined", Type: "undefined"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
||||
s.fmt.TestRunStarted()
|
||||
s.run()
|
||||
s.fmt.Summary()
|
||||
|
||||
var exp bytes.Buffer
|
||||
_, err = io.WriteString(&exp, xml.Header)
|
||||
require.NoError(t, err)
|
||||
|
||||
enc := xml.NewEncoder(&exp)
|
||||
enc.Indent("", " ")
|
||||
err = enc.Encode(expected)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, exp.String(), buf.String())
|
||||
}
|
113
fmt_output_test.go
Обычный файл
113
fmt_output_test.go
Обычный файл
|
@ -0,0 +1,113 @@
|
|||
package godog_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
const fmtOutputTestsFeatureDir = "formatter-tests/features"
|
||||
|
||||
func Test_FmtOutput(t *testing.T) {
|
||||
pkg := os.Getenv("GODOG_TESTED_PACKAGE")
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", "github.com/cucumber/godog")
|
||||
|
||||
featureFiles, err := listFmtOutputTestsFeatureFiles()
|
||||
require.Nil(t, err)
|
||||
|
||||
formatters := []string{"cucumber", "events", "junit", "pretty", "progress"}
|
||||
|
||||
for _, fmtName := range formatters {
|
||||
for _, featureFile := range featureFiles {
|
||||
testName := fmt.Sprintf("%s/%s", fmtName, featureFile)
|
||||
featureFilePath := fmt.Sprintf("%s/%s", fmtOutputTestsFeatureDir, featureFile)
|
||||
t.Run(testName, fmtOutputTest(fmtName, testName, featureFilePath))
|
||||
}
|
||||
}
|
||||
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", pkg)
|
||||
}
|
||||
|
||||
func listFmtOutputTestsFeatureFiles() (featureFiles []string, err error) {
|
||||
err = filepath.Walk(fmtOutputTestsFeatureDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !info.IsDir() {
|
||||
featureFiles = append(featureFiles, info.Name())
|
||||
return nil
|
||||
}
|
||||
|
||||
if info.Name() == "features" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return filepath.SkipDir
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func fmtOutputTest(fmtName, testName, featureFilePath string) func(*testing.T) {
|
||||
fmtOutputSuiteInitializer := func(s *godog.Suite) {
|
||||
s.Step(`^(?:a )?failing step`, failingStepDef)
|
||||
s.Step(`^(?:a )?pending step$`, pendingStepDef)
|
||||
s.Step(`^(?:a )?passing step$`, passingStepDef)
|
||||
s.Step(`^odd (\d+) and even (\d+) number$`, oddEvenStepDef)
|
||||
}
|
||||
|
||||
return func(t *testing.T) {
|
||||
expectOutputPath := strings.Replace(featureFilePath, "features", fmtName, 1)
|
||||
expectOutputPath = strings.TrimSuffix(expectOutputPath, path.Ext(expectOutputPath))
|
||||
if _, err := os.Stat(expectOutputPath); err != nil {
|
||||
t.Skipf("Couldn't find expected output file %q", expectOutputPath)
|
||||
}
|
||||
|
||||
expectedOutput, err := ioutil.ReadFile(expectOutputPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
var buf bytes.Buffer
|
||||
out := &tagColorWriter{w: &buf}
|
||||
|
||||
opts := godog.Options{
|
||||
Format: fmtName,
|
||||
Paths: []string{featureFilePath},
|
||||
Output: out,
|
||||
}
|
||||
|
||||
godog.RunWithOptions(fmtName, fmtOutputSuiteInitializer, opts)
|
||||
|
||||
expected := string(expectedOutput)
|
||||
actual := buf.String()
|
||||
assert.Equalf(t, expected, actual, "path: %s", expectOutputPath)
|
||||
}
|
||||
}
|
||||
|
||||
func passingStepDef() error { return nil }
|
||||
|
||||
func oddEvenStepDef(odd, even int) error { return oddOrEven(odd, even) }
|
||||
|
||||
func oddOrEven(odd, even int) error {
|
||||
if odd%2 == 0 {
|
||||
return fmt.Errorf("%d is not odd", odd)
|
||||
}
|
||||
if even%2 != 0 {
|
||||
return fmt.Errorf("%d is not even", even)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func pendingStepDef() error { return godog.ErrPending }
|
||||
|
||||
func failingStepDef() error { return fmt.Errorf("step failed") }
|
|
@ -2,7 +2,6 @@ package godog
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -22,73 +21,6 @@ Feature: basic
|
|||
Then two
|
||||
`
|
||||
|
||||
func TestProgressFormatterOutput(t *testing.T) {
|
||||
const path = "any.feature"
|
||||
|
||||
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(sampleGherkinFeature), (&messages.Incrementing{}).NewId)
|
||||
require.NoError(t, err)
|
||||
|
||||
pickles := gherkin.Pickles(*gd, path, (&messages.Incrementing{}).NewId)
|
||||
|
||||
var buf bytes.Buffer
|
||||
w := colors.Uncolored(&buf)
|
||||
r := runner{
|
||||
fmt: progressFunc("progress", w),
|
||||
features: []*feature{{
|
||||
GherkinDocument: gd,
|
||||
pickles: pickles,
|
||||
Path: path,
|
||||
Content: []byte(sampleGherkinFeature),
|
||||
}},
|
||||
initializer: func(s *Suite) {
|
||||
s.Step(`^passing$`, func() error { return nil })
|
||||
s.Step(`^failing$`, func() error { return fmt.Errorf("errored") })
|
||||
s.Step(`^pending$`, func() error { return ErrPending })
|
||||
},
|
||||
}
|
||||
|
||||
expected := `...F-.P-.UU.....F..P..U 23
|
||||
|
||||
|
||||
--- Failed steps:
|
||||
|
||||
Scenario: failing scenario # any.feature:10
|
||||
When failing # any.feature:11
|
||||
Error: errored
|
||||
|
||||
Scenario Outline: outline # any.feature:22
|
||||
When failing # any.feature:24
|
||||
Error: errored
|
||||
|
||||
|
||||
8 scenarios (2 passed, 2 failed, 2 pending, 2 undefined)
|
||||
23 steps (14 passed, 2 failed, 2 pending, 3 undefined, 2 skipped)
|
||||
0s
|
||||
|
||||
You can implement step definitions for undefined steps with these snippets:
|
||||
|
||||
func nextUndefined() error {
|
||||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func undefined() error {
|
||||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(` + "`^next undefined$`" + `, nextUndefined)
|
||||
s.Step(` + "`^undefined$`" + `, undefined)
|
||||
}
|
||||
|
||||
`
|
||||
|
||||
failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
|
||||
require.True(t, failed)
|
||||
|
||||
actual := buf.String()
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestProgressFormatterWhenStepPanics(t *testing.T) {
|
||||
const path = "any.feature"
|
||||
|
||||
|
@ -112,77 +44,7 @@ func TestProgressFormatterWhenStepPanics(t *testing.T) {
|
|||
require.True(t, failed)
|
||||
|
||||
actual := buf.String()
|
||||
assert.Contains(t, actual, "godog/fmt_progress_test.go:107")
|
||||
}
|
||||
|
||||
func TestProgressFormatterWithPassingMultisteps(t *testing.T) {
|
||||
const path = "any.feature"
|
||||
|
||||
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(basicGherkinFeature), (&messages.Incrementing{}).NewId)
|
||||
require.NoError(t, err)
|
||||
|
||||
pickles := gherkin.Pickles(*gd, path, (&messages.Incrementing{}).NewId)
|
||||
|
||||
var buf bytes.Buffer
|
||||
w := colors.Uncolored(&buf)
|
||||
r := runner{
|
||||
fmt: progressFunc("progress", w),
|
||||
features: []*feature{{GherkinDocument: gd, pickles: pickles}},
|
||||
initializer: func(s *Suite) {
|
||||
s.Step(`^sub1$`, func() error { return nil })
|
||||
s.Step(`^sub-sub$`, func() error { return nil })
|
||||
s.Step(`^sub2$`, func() Steps { return Steps{"sub-sub", "sub1", "one"} })
|
||||
s.Step(`^one$`, func() error { return nil })
|
||||
s.Step(`^two$`, func() Steps { return Steps{"sub1", "sub2"} })
|
||||
},
|
||||
}
|
||||
|
||||
failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
|
||||
require.False(t, failed)
|
||||
}
|
||||
|
||||
func TestProgressFormatterWithFailingMultisteps(t *testing.T) {
|
||||
const path = "some.feature"
|
||||
|
||||
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(basicGherkinFeature), (&messages.Incrementing{}).NewId)
|
||||
require.NoError(t, err)
|
||||
|
||||
pickles := gherkin.Pickles(*gd, path, (&messages.Incrementing{}).NewId)
|
||||
|
||||
var buf bytes.Buffer
|
||||
w := colors.Uncolored(&buf)
|
||||
r := runner{
|
||||
fmt: progressFunc("progress", w),
|
||||
features: []*feature{{GherkinDocument: gd, pickles: pickles, Path: path}},
|
||||
initializer: func(s *Suite) {
|
||||
s.Step(`^sub1$`, func() error { return nil })
|
||||
s.Step(`^sub-sub$`, func() error { return fmt.Errorf("errored") })
|
||||
s.Step(`^sub2$`, func() Steps { return Steps{"sub-sub", "sub1", "one"} })
|
||||
s.Step(`^one$`, func() error { return nil })
|
||||
s.Step(`^two$`, func() Steps { return Steps{"sub1", "sub2"} })
|
||||
},
|
||||
}
|
||||
|
||||
failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
|
||||
require.True(t, failed)
|
||||
|
||||
expected := `.F 2
|
||||
|
||||
|
||||
--- Failed steps:
|
||||
|
||||
Scenario: passing scenario # some.feature:4
|
||||
Then two # some.feature:6
|
||||
Error: sub2: sub-sub: errored
|
||||
|
||||
|
||||
1 scenarios (1 failed)
|
||||
2 steps (1 passed, 1 failed)
|
||||
0s
|
||||
`
|
||||
|
||||
actual := buf.String()
|
||||
assert.Equal(t, expected, actual)
|
||||
assert.Contains(t, actual, "godog/fmt_progress_test.go:39")
|
||||
}
|
||||
|
||||
func TestProgressFormatterWithPanicInMultistep(t *testing.T) {
|
||||
|
|
70
fmt_test.go
70
fmt_test.go
|
@ -1,25 +1,67 @@
|
|||
package godog
|
||||
package godog_test
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
func TestShouldFindFormatter(t *testing.T) {
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func Test_FindFmt(t *testing.T) {
|
||||
cases := map[string]bool{
|
||||
"progress": true, // true means should be available
|
||||
"unknown": false,
|
||||
"junit": true,
|
||||
"cucumber": true,
|
||||
"pretty": true,
|
||||
"custom": true, // is available for test purposes only
|
||||
"events": true,
|
||||
"junit": true,
|
||||
"pretty": true,
|
||||
"progress": true,
|
||||
"unknown": false,
|
||||
"undef": false,
|
||||
}
|
||||
|
||||
for name, shouldFind := range cases {
|
||||
actual := FindFmt(name)
|
||||
if actual == nil && shouldFind {
|
||||
t.Fatalf("expected %s formatter should be available", name)
|
||||
}
|
||||
if actual != nil && !shouldFind {
|
||||
t.Fatalf("expected %s formatter should not be available", name)
|
||||
for name, expected := range cases {
|
||||
t.Run(
|
||||
name,
|
||||
func(t *testing.T) {
|
||||
actual := godog.FindFmt(name)
|
||||
|
||||
if expected {
|
||||
assert.NotNilf(t, actual, "expected %s formatter should be available", name)
|
||||
} else {
|
||||
assert.Nilf(t, actual, "expected %s formatter should be available", name)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_AvailableFormatters(t *testing.T) {
|
||||
expected := map[string]string{
|
||||
"cucumber": "Produces cucumber JSON format output.",
|
||||
"custom": "custom format description", // is available for test purposes only
|
||||
"events": "Produces JSON event stream, based on spec: 0.1.0.",
|
||||
"junit": "Prints junit compatible xml to stdout",
|
||||
"pretty": "Prints every feature with runtime statuses.",
|
||||
"progress": "Prints a character per step.",
|
||||
}
|
||||
|
||||
actual := godog.AvailableFormatters()
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func Test_Format(t *testing.T) {
|
||||
actual := godog.FindFmt("Test_Format")
|
||||
require.Nil(t, actual)
|
||||
|
||||
godog.Format("Test_Format", "...", testFormatterFunc)
|
||||
actual = godog.FindFmt("Test_Format")
|
||||
|
||||
assert.NotNil(t, actual)
|
||||
}
|
||||
|
||||
func testFormatterFunc(suiteName string, out io.Writer) godog.Formatter {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"name": "passing step",
|
||||
"line": 13,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -60,7 +60,7 @@
|
|||
"name": "passing step",
|
||||
"line": 13,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -72,7 +72,7 @@
|
|||
"name": "odd 1 and even 2 number",
|
||||
"line": 13,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:65"
|
||||
"location": "fmt_output_test.go:99"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -112,7 +112,7 @@
|
|||
"name": "passing step",
|
||||
"line": 14,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -124,7 +124,7 @@
|
|||
"name": "passing step",
|
||||
"line": 14,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -136,7 +136,7 @@
|
|||
"name": "odd 2 and even 0 number",
|
||||
"line": 14,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:65"
|
||||
"location": "fmt_output_test.go:99"
|
||||
},
|
||||
"result": {
|
||||
"status": "failed",
|
||||
|
@ -177,7 +177,7 @@
|
|||
"name": "passing step",
|
||||
"line": 15,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -189,7 +189,7 @@
|
|||
"name": "passing step",
|
||||
"line": 15,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -201,7 +201,7 @@
|
|||
"name": "odd 3 and even 11 number",
|
||||
"line": 15,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:65"
|
||||
"location": "fmt_output_test.go:99"
|
||||
},
|
||||
"result": {
|
||||
"status": "failed",
|
||||
|
@ -242,7 +242,7 @@
|
|||
"name": "passing step",
|
||||
"line": 20,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -254,7 +254,7 @@
|
|||
"name": "passing step",
|
||||
"line": 20,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -266,7 +266,7 @@
|
|||
"name": "odd 1 and even 14 number",
|
||||
"line": 20,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:65"
|
||||
"location": "fmt_output_test.go:99"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -306,7 +306,7 @@
|
|||
"name": "passing step",
|
||||
"line": 21,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -318,7 +318,7 @@
|
|||
"name": "passing step",
|
||||
"line": 21,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -330,7 +330,7 @@
|
|||
"name": "odd 3 and even 9 number",
|
||||
"line": 21,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:65"
|
||||
"location": "fmt_output_test.go:99"
|
||||
},
|
||||
"result": {
|
||||
"status": "failed",
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"name": "passing step",
|
||||
"line": 4,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -32,7 +32,7 @@
|
|||
"name": "passing step",
|
||||
"line": 5,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -44,7 +44,7 @@
|
|||
"name": "passing step",
|
||||
"line": 8,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -56,7 +56,7 @@
|
|||
"name": "passing step",
|
||||
"line": 9,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"name": "a passing step",
|
||||
"line": 7,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"name": "passing step",
|
||||
"line": 4,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -32,7 +32,7 @@
|
|||
"name": "failing step",
|
||||
"line": 5,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:79"
|
||||
"location": "fmt_output_test.go:113"
|
||||
},
|
||||
"result": {
|
||||
"status": "failed",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"name": "passing step",
|
||||
"line": 6,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "skipped"
|
||||
|
@ -77,7 +77,7 @@
|
|||
"name": "passing step",
|
||||
"line": 10,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "skipped"
|
||||
|
@ -109,7 +109,7 @@
|
|||
"name": "passing step",
|
||||
"line": 14,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "skipped"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"name": "passing step",
|
||||
"line": 4,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -32,7 +32,7 @@
|
|||
"name": "failing step",
|
||||
"line": 5,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:79"
|
||||
"location": "fmt_output_test.go:113"
|
||||
},
|
||||
"result": {
|
||||
"status": "failed",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"name": "passing step",
|
||||
"line": 8,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "skipped"
|
||||
|
@ -56,7 +56,7 @@
|
|||
"name": "passing step",
|
||||
"line": 9,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "skipped"
|
||||
|
@ -77,7 +77,7 @@
|
|||
"name": "passing step",
|
||||
"line": 4,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "passed",
|
||||
|
@ -89,7 +89,7 @@
|
|||
"name": "failing step",
|
||||
"line": 5,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:79"
|
||||
"location": "fmt_output_test.go:113"
|
||||
},
|
||||
"result": {
|
||||
"status": "failed",
|
||||
|
@ -102,7 +102,7 @@
|
|||
"name": "passing step",
|
||||
"line": 12,
|
||||
"match": {
|
||||
"location": "formatters_print_test.go:63"
|
||||
"location": "fmt_output_test.go:97"
|
||||
},
|
||||
"result": {
|
||||
"status": "skipped"
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/scenario_outline.feature:2","source":"@outline @tag\nFeature: outline\n\n @scenario\n Scenario Outline: outline\n Given passing step\n When passing step\n Then odd \u003codd\u003e and even \u003ceven\u003e number\n\n @tagged\n Examples: tagged\n | odd | even |\n | 1 | 2 |\n | 2 | 0 |\n | 3 | 11 |\n\n @tag2\n Examples:\n | odd | even |\n | 1 | 14 |\n | 3 | 9 |\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_outline.feature:13","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"formatters_print_test.go:65 -\u003e oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:99 -\u003e github.com/cucumber/godog_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/scenario_outline.feature:13","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_outline.feature:14","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"formatters_print_test.go:65 -\u003e oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:99 -\u003e github.com/cucumber/godog_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871,"status":"failed","summary":"2 is not odd"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/scenario_outline.feature:14","timestamp":-6795364578871,"status":"failed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_outline.feature:15","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"formatters_print_test.go:65 -\u003e oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:99 -\u003e github.com/cucumber/godog_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871,"status":"failed","summary":"11 is not even"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/scenario_outline.feature:15","timestamp":-6795364578871,"status":"failed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_outline.feature:20","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"formatters_print_test.go:65 -\u003e oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:99 -\u003e github.com/cucumber/godog_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/scenario_outline.feature:20","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_outline.feature:21","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"formatters_print_test.go:65 -\u003e oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:99 -\u003e github.com/cucumber/godog_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871,"status":"failed","summary":"9 is not even"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/scenario_outline.feature:21","timestamp":-6795364578871,"status":"failed"}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/scenario_with_background.feature:1","source":"Feature: single scenario with background\n\n Background: named\n Given passing step\n And passing step\n\n Scenario: scenario\n When passing step\n Then passing step\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_with_background.feature:7","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:4","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:4","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:4","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_with_background.feature:4","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:5","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:5","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:5","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_with_background.feature:5","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:8","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:8","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_with_background.feature:8","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:9","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:9","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:9","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_with_background.feature:9","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/scenario_with_background.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/single_scenario_with_passing_step.feature:1","source":"Feature: single passing scenario\n describes\n a single scenario\n feature\n\n Scenario: one step passing\n Given a passing step\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/single_scenario_with_passing_step.feature:6","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/single_scenario_with_passing_step.feature:7","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/single_scenario_with_passing_step.feature:7","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/single_scenario_with_passing_step.feature:7","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/single_scenario_with_passing_step.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/single_scenario_with_passing_step.feature:6","timestamp":-6795364578871,"status":"passed"}
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/some_scenarions_including_failing.feature:1","source":"Feature: some scenarios\n\n Scenario: failing\n Given passing step\n When failing step\n Then passing step\n\n Scenario: pending\n When pending step\n Then passing step\n\n Scenario: undefined\n When undefined\n Then passing step\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:3","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:4","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:4","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:4","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:4","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:5","definition_id":"formatters_print_test.go:79 -\u003e failingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:5","definition_id":"fmt_output_test.go:113 -\u003e github.com/cucumber/godog_test.failingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:5","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:5","timestamp":-6795364578871,"status":"failed","summary":"step failed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:6","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:6","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:6","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:3","timestamp":-6795364578871,"status":"failed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:8","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:9","definition_id":"formatters_print_test.go:77 -\u003e pendingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:9","definition_id":"fmt_output_test.go:111 -\u003e github.com/cucumber/godog_test.pendingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:9","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:9","timestamp":-6795364578871,"status":"pending"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:10","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:10","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:10","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:10","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:8","timestamp":-6795364578871,"status":"pending"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:12","timestamp":-6795364578871}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:13","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:13","timestamp":-6795364578871,"status":"undefined"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:12","timestamp":-6795364578871,"status":"undefined"}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:1","source":"Feature: two scenarios with background fail\n\n Background:\n Given passing step\n And failing step\n\n Scenario: one\n When passing step\n Then passing step\n\n Scenario: two\n Then passing step\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:7","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","definition_id":"formatters_print_test.go:79 -\u003e failingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","definition_id":"fmt_output_test.go:113 -\u003e github.com/cucumber/godog_test.failingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","timestamp":-6795364578871,"status":"failed","summary":"step failed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:8","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:8","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:8","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:8","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:9","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:9","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:9","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:9","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:7","timestamp":-6795364578871,"status":"failed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:11","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","definition_id":"formatters_print_test.go:79 -\u003e failingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","definition_id":"fmt_output_test.go:113 -\u003e github.com/cucumber/godog_test.failingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","timestamp":-6795364578871,"status":"failed","summary":"step failed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:12","definition_id":"formatters_print_test.go:63 -\u003e passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:12","definition_id":"fmt_output_test.go:97 -\u003e github.com/cucumber/godog_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:12","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:12","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:11","timestamp":-6795364578871,"status":"failed"}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<bold-white>Feature:</bold-white> outline
|
||||
|
||||
<bold-white>Scenario Outline:</bold-white> outline <bold-black># formatter-tests/features/scenario_outline.feature:5</bold-black>
|
||||
<cyan>Given</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>odd </cyan><bold-cyan><odd></bold-cyan><cyan> and even </cyan><bold-cyan><even></bold-cyan><cyan> number</cyan> <bold-black># formatters_print_test.go:65 -> oddEvenStepDef</bold-black>
|
||||
<cyan>Given</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>odd </cyan><bold-cyan><odd></bold-cyan><cyan> and even </cyan><bold-cyan><even></bold-cyan><cyan> number</cyan> <bold-black># fmt_output_test.go:99 -> github.com/cucumber/godog_test.oddEvenStepDef</bold-black>
|
||||
|
||||
<bold-white>Examples:</bold-white> tagged
|
||||
| <cyan>odd</cyan> | <cyan>even</cyan> |
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<bold-white>Feature:</bold-white> single scenario with background
|
||||
|
||||
<bold-white>Background:</bold-white> named
|
||||
<green>Given</green> <green>passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> scenario <bold-black># formatter-tests/features/scenario_with_background.feature:7</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
1 scenarios (<green>1 passed</green>)
|
||||
4 steps (<green>4 passed</green>)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
feature
|
||||
|
||||
<bold-white>Scenario:</bold-white> one step passing <bold-black># formatter-tests/features/single_scenario_with_passing_step.feature:6</bold-black>
|
||||
<green>Given</green> <green>a passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<green>Given</green> <green>a passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
1 scenarios (<green>1 passed</green>)
|
||||
1 steps (<green>1 passed</green>)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<bold-white>Feature:</bold-white> some scenarios
|
||||
|
||||
<bold-white>Scenario:</bold-white> failing <bold-black># formatter-tests/features/some_scenarions_including_failing.feature:3</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<red>When</red> <red>failing step</red> <bold-black># formatters_print_test.go:79 -> failingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<red>When</red> <red>failing step</red> <bold-black># fmt_output_test.go:113 -> github.com/cucumber/godog_test.failingStepDef</bold-black>
|
||||
<bold-red>step failed</bold-red>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> pending <bold-black># formatter-tests/features/some_scenarions_including_failing.feature:8</bold-black>
|
||||
<yellow>When</yellow> <yellow>pending step</yellow> <bold-black># formatters_print_test.go:77 -> pendingStepDef</bold-black>
|
||||
<yellow>When</yellow> <yellow>pending step</yellow> <bold-black># fmt_output_test.go:111 -> github.com/cucumber/godog_test.pendingStepDef</bold-black>
|
||||
<yellow>TODO: write pending definition</yellow>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> undefined <bold-black># formatter-tests/features/some_scenarions_including_failing.feature:12</bold-black>
|
||||
<yellow>When</yellow> <yellow>undefined</yellow>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
--- <red>Failed steps:</red>
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<bold-white>Feature:</bold-white> two scenarios with background fail
|
||||
|
||||
<bold-white>Background:</bold-white>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<red>And</red> <red>failing step</red> <bold-black># formatters_print_test.go:79 -> failingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<red>And</red> <red>failing step</red> <bold-black># fmt_output_test.go:113 -> github.com/cucumber/godog_test.failingStepDef</bold-black>
|
||||
<bold-red>step failed</bold-red>
|
||||
|
||||
<bold-white>Scenario:</bold-white> one <bold-black># formatter-tests/features/two_scenarios_with_background_fail.feature:7</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> two <bold-black># formatter-tests/features/two_scenarios_with_background_fail.feature:11</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># formatters_print_test.go:63 -> passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:97 -> github.com/cucumber/godog_test.passingStepDef</bold-black>
|
||||
|
||||
--- <red>Failed steps:</red>
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
package godog
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPrintingFormatters(t *testing.T) {
|
||||
features, err := parseFeatures("", []string{"formatter-tests"})
|
||||
require.NoError(t, err)
|
||||
|
||||
var buf bytes.Buffer
|
||||
out := &tagColorWriter{w: &buf}
|
||||
|
||||
suite := &Suite{
|
||||
features: features,
|
||||
}
|
||||
|
||||
// inlining steps to have same source code line reference
|
||||
suite.Step(`^(?:a )?failing step`, failingStepDef)
|
||||
suite.Step(`^(?:a )?pending step$`, pendingStepDef)
|
||||
suite.Step(`^(?:a )?passing step$`, passingStepDef)
|
||||
suite.Step(`^odd (\d+) and even (\d+) number$`, oddEvenStepDef)
|
||||
|
||||
pkg := os.Getenv("GODOG_TESTED_PACKAGE")
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", "github.com/cucumber/godog")
|
||||
for _, feat := range features {
|
||||
for name := range AvailableFormatters() {
|
||||
expectOutputPath := strings.Replace(feat.Path, "features", name, 1)
|
||||
expectOutputPath = strings.TrimSuffix(expectOutputPath, path.Ext(expectOutputPath))
|
||||
if _, err := os.Stat(expectOutputPath); err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
buf.Reset() // flush the output
|
||||
suite.fmt = FindFmt(name)(name, out) // prepare formatter
|
||||
suite.features = []*feature{feat} // set the feature
|
||||
|
||||
expectedOutput, err := ioutil.ReadFile(expectOutputPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
suite.fmt.TestRunStarted()
|
||||
suite.run()
|
||||
suite.fmt.Summary()
|
||||
|
||||
expected := string(expectedOutput)
|
||||
actual := buf.String()
|
||||
assert.Equalf(t, expected, actual, "path: %s", expectOutputPath)
|
||||
}
|
||||
}
|
||||
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", pkg)
|
||||
}
|
||||
|
||||
func passingStepDef() error { return nil }
|
||||
|
||||
func oddEvenStepDef(odd, even int) error { return oddOrEven(odd, even) }
|
||||
|
||||
func oddOrEven(odd, even int) error {
|
||||
if odd%2 == 0 {
|
||||
return fmt.Errorf("%d is not odd", odd)
|
||||
}
|
||||
if even%2 != 0 {
|
||||
return fmt.Errorf("%d is not even", even)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func pendingStepDef() error { return ErrPending }
|
||||
|
||||
func failingStepDef() error { return fmt.Errorf("step failed") }
|
Загрузка…
Создание таблицы
Сослаться в новой задаче