Сравнить коммиты
Нет общих коммитов. «main» и «v0.15.0» имеют совершенно разные истории.
108 изменённых файлов: 322 добавлений и 2865 удалений
2
.github/workflows/gorelease.yml
предоставленный
2
.github/workflows/gorelease.yml
предоставленный
|
@ -33,7 +33,7 @@ jobs:
|
|||
OUTPUT=$(gorelease 2>&1 || exit 0)
|
||||
echo "${OUTPUT}"
|
||||
OUTPUT="${OUTPUT//$'\n'/%0A}"
|
||||
echo "report=$OUTPUT" >> $GITHUB_OUTPUT
|
||||
echo "::set-output name=report::$OUTPUT"
|
||||
- name: Comment Report
|
||||
continue-on-error: true
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
|
|
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -8,16 +8,6 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
|
|||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
- Step text is added to "step is undefined" error - ([669](https://github.com/cucumber/godog/pull/669) - [vearutop](https://github.com/vearutop))
|
||||
|
||||
### Changed
|
||||
- Replace deprecated `::set-output` - ([681](https://github.com/cucumber/godog/pull/681) - [nodeg](https://github.com/nodeg))
|
||||
|
||||
### Fixed
|
||||
- fix(errors): fix(errors): Fix expected Step argument count for steps with `context.Context` ([679](https://github.com/cucumber/godog/pull/679) - [tigh-latte](https://github.com/tigh-latte))
|
||||
- fix(formatter): On concurrent execution, execute formatter at end of Scenario - ([645](https://github.com/cucumber/godog/pull/645) - [tigh-latte](https://github.com/tigh-latte))
|
||||
|
||||
## [v0.15.0]
|
||||
|
||||
### Added
|
||||
|
@ -49,7 +39,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
|
|||
|
||||
### Changed
|
||||
- Update test.yml ([583](https://github.com/cucumber/godog/pull/583) - [vearutop](https://github.com/vearutop))
|
||||
|
||||
|
||||
## [v0.13.0]
|
||||
### Added
|
||||
- Support for reading feature files from an `fs.FS` ([550](https://github.com/cucumber/godog/pull/550) - [tigh-latte](https://github.com/tigh-latte))
|
||||
|
|
138
Magefile.go
138
Magefile.go
|
@ -1,138 +0,0 @@
|
|||
//go:build mage
|
||||
// +build mage
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
// mage:import
|
||||
. "magefile/docker"
|
||||
)
|
||||
|
||||
var (
|
||||
GolangVolume = "golang.upstream"
|
||||
)
|
||||
|
||||
func init() {
|
||||
AppName = "godog"
|
||||
ImageName = "my/go"
|
||||
}
|
||||
|
||||
func Test() {
|
||||
TestNative()
|
||||
}
|
||||
func TestNative() {
|
||||
Bash(`sudo docker run -ti --rm \
|
||||
-h host \
|
||||
--net=bridge \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ` + GolangVolume + `:/usr/local/go:ro \
|
||||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
\
|
||||
-w /app \
|
||||
-u 1000 \
|
||||
\
|
||||
--entrypoint=/bin/bash \
|
||||
\
|
||||
` + ImageName + " -c '" + `\
|
||||
go test -race -count=1 ./... \
|
||||
'`)
|
||||
}
|
||||
|
||||
func TestMakefile() {
|
||||
Bash(`sudo docker run -ti --rm \
|
||||
-h host \
|
||||
--net=bridge \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ` + GolangVolume + `:/usr/local/go:ro \
|
||||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
\
|
||||
-w /app \
|
||||
-u 1000 \
|
||||
\
|
||||
--entrypoint=/bin/bash \
|
||||
\
|
||||
` + ImageName + " -c '" + `set -x; \
|
||||
make test \
|
||||
'`)
|
||||
}
|
||||
|
||||
func TestSnippets() {
|
||||
Bash(`sudo docker run -ti --rm \
|
||||
-h host \
|
||||
--net=bridge \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ` + GolangVolume + `:/usr/local/go:ro \
|
||||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
\
|
||||
-w /app \
|
||||
-u 1000 \
|
||||
\
|
||||
--entrypoint=/bin/bash \
|
||||
\
|
||||
` + ImageName + " -c '" + `set -x; \
|
||||
godog run -f progress -c 4 \
|
||||
features/snippets.feature \
|
||||
'`)
|
||||
}
|
||||
|
||||
func TestTags() {
|
||||
Bash(`sudo docker run -ti --rm \
|
||||
-h host \
|
||||
--net=bridge \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ` + GolangVolume + `:/usr/local/go:ro \
|
||||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
\
|
||||
-w /app \
|
||||
-u 1000 \
|
||||
\
|
||||
--entrypoint=/bin/bash \
|
||||
\
|
||||
` + ImageName + " -c '" + `set -x; \
|
||||
godog run -f progress -c 4 \
|
||||
features/tags.feature \
|
||||
'`)
|
||||
}
|
||||
|
||||
func Install() {
|
||||
Bash(`sudo docker run -ti --rm \
|
||||
-h host \
|
||||
--net=bridge \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ` + GolangVolume + `:/usr/local/go:ro \
|
||||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
\
|
||||
-w /app \
|
||||
-u 1000 \
|
||||
\
|
||||
--entrypoint=/bin/bash \
|
||||
\
|
||||
` + ImageName + " -c '" + `set -x; \
|
||||
go install ./cmd/godog \
|
||||
'`)
|
||||
}
|
6
Makefile
6
Makefile
|
@ -23,8 +23,8 @@ check-go-version:
|
|||
test: check-go-version
|
||||
@echo "running all tests"
|
||||
@go fmt ./...
|
||||
@go run honnef.co/go/tools/cmd/staticcheck@v0.5.1 git.golang1.ru/softonik/godog
|
||||
@go run honnef.co/go/tools/cmd/staticcheck@v0.5.1 git.golang1.ru/softonik/godog/cmd/godog
|
||||
@go run honnef.co/go/tools/cmd/staticcheck@v0.4.7 github.com/cucumber/godog
|
||||
@go run honnef.co/go/tools/cmd/staticcheck@v0.4.7 github.com/cucumber/godog/cmd/godog
|
||||
go vet ./...
|
||||
go test -race ./...
|
||||
go run ./cmd/godog -f progress -c 4
|
||||
|
@ -69,7 +69,7 @@ artifacts:
|
|||
|
||||
define _build
|
||||
mkdir $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2
|
||||
env GOOS=$1 GOARCH=$2 go build -ldflags "-X git.golang1.ru/softonik/godog.Version=$(VERS)" -o $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/godog ./cmd/godog
|
||||
env GOOS=$1 GOARCH=$2 go build -ldflags "-X github.com/cucumber/godog.Version=$(VERS)" -o $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/godog ./cmd/godog
|
||||
cp README.md $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/README.md
|
||||
cp LICENSE $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/LICENSE
|
||||
cd $(ARTIFACT_DIR) && tar -c --use-compress-program="pigz --fast" -f godog-$(VERS)-$1-$2.tar.gz godog-$(VERS)-$1-$2 && cd ..
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
[](https://vshymanskyy.github.io/StandWithUkraine)
|
||||
[](https://github.com/cucumber/godog/actions?query=branch%main+workflow%3Atest)
|
||||
[](https://pkg.go.dev/github.com/cucumber/godog)
|
||||
[](https://codecov.io/gh/cucumber/godog)
|
||||
|
|
|
@ -44,7 +44,7 @@ Now we have described a success case and an error when the request method is not
|
|||
Execute `godog run`. You should see the following result, which says that all of our
|
||||
steps are yet undefined and provide us with the snippets to implement them.
|
||||
|
||||

|
||||

|
||||
|
||||
### Step 3
|
||||
|
||||
|
@ -56,7 +56,7 @@ need to store state within steps (a response), we should introduce a structure w
|
|||
package main
|
||||
|
||||
import (
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
type apiFeature struct {
|
||||
|
@ -114,7 +114,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
type apiFeature struct {
|
||||
|
@ -228,7 +228,7 @@ import (
|
|||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func getVersion(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -282,7 +282,7 @@ used to respond with the correct constant version number.
|
|||
|
||||
Run our tests to see whether everything is happening as we have expected: `go test -v`
|
||||
|
||||

|
||||

|
||||
|
||||
### Conclusions
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func getVersion(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
type apiFeature struct {
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/colors"
|
||||
)
|
||||
|
||||
var opts = godog.Options{
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"io"
|
||||
"math"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/colors"
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# An example of API with DB
|
||||
|
||||
The following example demonstrates steps how we describe and test our API with DB using **godog**.
|
||||
To start with, see [API example](https://git.golang1.ru/softonik/godog/tree/master/_examples/api) before.
|
||||
To start with, see [API example](https://github.com/cucumber/godog/tree/master/_examples/api) before.
|
||||
We have extended it to be used with database.
|
||||
|
||||
The interesting point is, that we have [go-txdb](https://github.com/DATA-DOG/go-txdb) library,
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
|
||||
txdb "github.com/DATA-DOG/go-txdb"
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
module git.golang1.ru/softonik/godog/_examples
|
||||
module github.com/cucumber/godog/_examples
|
||||
|
||||
go 1.16
|
||||
|
||||
replace git.golang1.ru/softonik/godog => ../
|
||||
replace github.com/cucumber/godog => ../
|
||||
|
||||
require (
|
||||
github.com/DATA-DOG/go-txdb v0.1.6
|
||||
git.golang1.ru/softonik/godog v0.15.0
|
||||
github.com/cucumber/godog v0.14.1
|
||||
github.com/go-sql-driver/mysql v1.7.1
|
||||
github.com/spf13/pflag v1.0.6
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.8.2
|
||||
)
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
|
|||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
|
|
|
@ -15,12 +15,12 @@ import (
|
|||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.golang1.ru/softonik/godog/_examples/godogs"
|
||||
"github.com/cucumber/godog/_examples/godogs"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/colors"
|
||||
)
|
||||
|
||||
var opts = godog.Options{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
This example is to help reproduce issue [#383](https://git.golang1.ru/softonik/godog/issues/383)
|
||||
This example is to help reproduce issue [#383](https://github.com/cucumber/godog/issues/383)
|
||||
|
||||
To run the example:
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@ module incorrect-project-structure
|
|||
|
||||
go 1.13
|
||||
|
||||
require git.golang1.ru/softonik/godog v0.15.0
|
||||
require github.com/cucumber/godog v0.14.1
|
||||
|
||||
replace git.golang1.ru/softonik/godog => ../../
|
||||
replace github.com/cucumber/godog => ../../
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
import "git.golang1.ru/softonik/godog"
|
||||
import "github.com/cucumber/godog"
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"go/build"
|
||||
"path/filepath"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/builder"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/builder"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -40,7 +40,7 @@ The test runner can be executed with the same flags as when using godog run.`,
|
|||
|
||||
func buildCmdRunFunc(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
|
||||
fmt.Println(colors.Yellow("See https://git.golang1.ru/softonik/godog/discussions/478 for details."))
|
||||
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))
|
||||
|
||||
bin, err := filepath.Abs(buildOutput)
|
||||
if err != nil {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
)
|
||||
|
||||
var version bool
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/builder"
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/builder"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
)
|
||||
|
||||
var opts flags.Options
|
||||
|
@ -44,7 +44,7 @@ buildable go source.`,
|
|||
|
||||
func runCmdRunFunc(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
|
||||
fmt.Println(colors.Yellow("See https://git.golang1.ru/softonik/godog/discussions/478 for details."))
|
||||
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))
|
||||
|
||||
osArgs := os.Args[1:]
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
// CreateVersionCmd creates the version subcommand.
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"git.golang1.ru/softonik/godog/cmd/godog/internal"
|
||||
"github.com/cucumber/godog/cmd/godog/internal"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -3,7 +3,7 @@ package godog_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func ExampleTestSuite_Run_subtests() {
|
||||
|
|
|
@ -153,43 +153,3 @@ Feature: undefined step snippets
|
|||
ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts)
|
||||
}
|
||||
"""
|
||||
|
||||
Scenario: Для русских сценариев генерируются русские функции
|
||||
Given a feature "undefined.feature" file:
|
||||
"""
|
||||
# language: ru
|
||||
|
||||
Функционал: суперфича
|
||||
|
||||
Сценарий: делает что-то полезное
|
||||
Дано что-то
|
||||
Когда я делаю ещё что-то
|
||||
То получается ещё более что-то
|
||||
"""
|
||||
When I run feature suite
|
||||
Then the following steps should be undefined:
|
||||
"""
|
||||
получается ещё более что-то
|
||||
что-то
|
||||
я делаю ещё что-то
|
||||
"""
|
||||
And the undefined step snippets should be:
|
||||
"""
|
||||
func получаетсяЕщёБолееЧтото() error {
|
||||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func чтото() error {
|
||||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func яДелаюЕщёЧтото() error {
|
||||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото)
|
||||
ctx.Step(`^что-то$`, чтото)
|
||||
ctx.Step(`^я делаю ещё что-то$`, яДелаюЕщёЧтото)
|
||||
}
|
||||
"""
|
||||
|
|
|
@ -125,75 +125,3 @@ Feature: tag filters
|
|||
"""
|
||||
a feature path "four"
|
||||
"""
|
||||
|
||||
Scenario: empty filter and scenarios with f-tag - are executed only
|
||||
Given a feature "normal.feature" file:
|
||||
"""
|
||||
Feature: f-tagged
|
||||
|
||||
Scenario: one
|
||||
Given a feature path "one"
|
||||
|
||||
Scenario: two
|
||||
Given a feature path "two"
|
||||
|
||||
@f
|
||||
Scenario: three
|
||||
Given a feature path "three"
|
||||
|
||||
@f
|
||||
Scenario: four
|
||||
Given a feature path "four"
|
||||
"""
|
||||
When I run feature suite with tags ""
|
||||
Then the suite should have passed
|
||||
And I should have 2 scenario registered
|
||||
And the following steps should be passed:
|
||||
"""
|
||||
a feature path "three"
|
||||
a feature path "four"
|
||||
"""
|
||||
|
||||
Scenario: two feature files and scenarios with f-tag - are executed only
|
||||
Given a feature "normal.feature" file:
|
||||
"""
|
||||
Feature: f-tagged
|
||||
|
||||
Scenario: one
|
||||
Given a feature path "one"
|
||||
|
||||
Scenario: two
|
||||
Given a feature path "two"
|
||||
|
||||
@f
|
||||
Scenario: three
|
||||
Given a feature path "three"
|
||||
|
||||
@f
|
||||
Scenario: four
|
||||
Given a feature path "four"
|
||||
"""
|
||||
And a feature "another.feature" file:
|
||||
"""
|
||||
Feature: non-tagged
|
||||
|
||||
Scenario: five
|
||||
Given a feature path "five"
|
||||
|
||||
Scenario: six
|
||||
Given a feature path "six"
|
||||
|
||||
Scenario: seven
|
||||
Given a feature path "seven"
|
||||
|
||||
Scenario: eight
|
||||
Given a feature path "eight"
|
||||
"""
|
||||
When I run feature suite with tags ""
|
||||
Then the suite should have passed
|
||||
And I should have 2 scenario registered
|
||||
And the following steps should be passed:
|
||||
"""
|
||||
a feature path "three"
|
||||
a feature path "four"
|
||||
"""
|
||||
|
|
6
flags.go
6
flags.go
|
@ -8,8 +8,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
)
|
||||
|
||||
// repeats a space n times
|
||||
|
@ -208,7 +208,7 @@ func usage(set *flag.FlagSet, w io.Writer) func() {
|
|||
|
||||
// --- GENERAL ---
|
||||
fmt.Fprintln(w, colors.Yellow("Usage:"))
|
||||
fmt.Fprint(w, s(2)+"go test [options]\n\n")
|
||||
fmt.Fprintf(w, s(2)+"go test [options]\n\n")
|
||||
|
||||
// --- OPTIONS ---
|
||||
fmt.Fprintln(w, colors.Yellow("Options:"))
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/formatters"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/formatters"
|
||||
)
|
||||
|
||||
func TestFlagsShouldRandomizeAndGenerateSeed(t *testing.T) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
)
|
||||
|
||||
// Choose randomly assigns a convenient pseudo-random seed value.
|
||||
|
|
|
@ -3,7 +3,7 @@ package godog
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
10
fmt.go
10
fmt.go
|
@ -6,11 +6,11 @@ import (
|
|||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
internal_fmt "git.golang1.ru/softonik/godog/internal/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/storage"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
internal_fmt "github.com/cucumber/godog/internal/formatters"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/storage"
|
||||
)
|
||||
|
||||
// FindFmt searches available formatters registered
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func Test_FindFmt(t *testing.T) {
|
||||
|
|
|
@ -74,12 +74,6 @@ type Formatter interface {
|
|||
Summary()
|
||||
}
|
||||
|
||||
// FlushFormatter is a `Formatter` but can be flushed.
|
||||
type FlushFormatter interface {
|
||||
Formatter
|
||||
Flush()
|
||||
}
|
||||
|
||||
// FormatterFunc builds a formatter with given
|
||||
// suite name and io.Writer to record output
|
||||
type FormatterFunc func(string, io.Writer) Formatter
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func Test_FindFmt(t *testing.T) {
|
||||
|
|
24
go.mod
24
go.mod
|
@ -1,27 +1,13 @@
|
|||
module git.golang1.ru/softonik/godog
|
||||
module github.com/cucumber/godog
|
||||
|
||||
go 1.24.2
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
git.golang1.ru/softonik/godog_and_gomega v1.0.0
|
||||
github.com/cucumber/gherkin/go/v26 v26.2.0
|
||||
github.com/hashicorp/go-memdb v1.3.5
|
||||
github.com/onsi/gomega v1.37.0
|
||||
github.com/hashicorp/go-memdb v1.3.4
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/pflag v1.0.6
|
||||
github.com/stretchr/testify v1.10.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.8.2
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
51
go.sum
51
go.sum
|
@ -1,33 +1,26 @@
|
|||
git.golang1.ru/softonik/godog_and_gomega v1.0.0 h1:2BhCJnuCW5mnRRFk7hN0thyz6Zj64udGhjVtVrjvmYQ=
|
||||
git.golang1.ru/softonik/godog_and_gomega v1.0.0/go.mod h1:Xf4wTfJZU3W8dULgIkyou+dd36zZ8Kw2FPD3cr3dR10=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cucumber/gherkin/go/v26 v26.2.0 h1:EgIjePLWiPeslwIWmNQ3XHcypPsWAHoMCz/YEBKP4GI=
|
||||
github.com/cucumber/gherkin/go/v26 v26.2.0/go.mod h1:t2GAPnB8maCT4lkHL99BDCVNzCh1d7dBhCLt150Nr/0=
|
||||
github.com/cucumber/messages/go/v21 v21.0.1 h1:wzA0LxwjlWQYZd32VTlAVDTkW6inOFmSM+RuOwHZiMI=
|
||||
github.com/cucumber/messages/go/v21 v21.0.1/go.mod h1:zheH/2HS9JLVFukdrsPWoPdmUtmYQAQPLk7w5vWsk5s=
|
||||
github.com/cucumber/messages/go/v22 v22.0.0/go.mod h1:aZipXTKc0JnjCsXrJnuZpWhtay93k7Rn3Dee7iyPJjs=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
|
||||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
|
||||
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=
|
||||
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-memdb v1.3.5 h1:b3taDMxCBCBVgyRrS1AZVHO14ubMYZB++QpNhBg+Nyo=
|
||||
github.com/hashicorp/go-memdb v1.3.5/go.mod h1:8IVKKBkVe+fxFgdFOYxzQQNjz+sWCyHCdIC/+5+Vy1Y=
|
||||
github.com/hashicorp/go-memdb v1.3.4 h1:XSL3NR682X/cVk2IeV0d70N4DZ9ljI885xAEU8IoK3c=
|
||||
github.com/hashicorp/go-memdb v1.3.4/go.mod h1:uBTr1oQbtuMgd1SSGoR8YV27eT3sBHbYiNm53bMpgSg=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
|
||||
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
|
||||
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
|
@ -35,30 +28,24 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
|
|||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0=
|
||||
github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM=
|
||||
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
|
||||
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
|
||||
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/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
|
||||
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
var astContextSrc = `package main
|
||||
|
||||
import (
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func MyContext(s *godog.Suite) {
|
||||
|
@ -18,7 +18,7 @@ func MyContext(s *godog.Suite) {
|
|||
var astTwoContextSrc = `package lib
|
||||
|
||||
import (
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func ApiContext(s *godog.Suite) {
|
||||
|
|
|
@ -23,13 +23,13 @@ var (
|
|||
compiler = filepath.Join(tooldir, "compile")
|
||||
linker = filepath.Join(tooldir, "link")
|
||||
gopaths = filepath.SplitList(build.Default.GOPATH)
|
||||
godogImportPath = "git.golang1.ru/softonik/godog"
|
||||
godogImportPath = "github.com/cucumber/godog"
|
||||
|
||||
// godep
|
||||
runnerTemplate = template.Must(template.New("testmain").Parse(`package main
|
||||
|
||||
import (
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
{{if or .TestSuiteContexts .ScenarioContexts}}_test "{{.ImportPath}}"{{end}}
|
||||
{{if or .XTestSuiteContexts .XScenarioContexts}}_xtest "{{.ImportPath}}_test"{{end}}
|
||||
{{if or .XTestSuiteContexts .XScenarioContexts}}"testing/internal/testdeps"{{end}}
|
||||
|
@ -70,7 +70,7 @@ func main() {
|
|||
// temp file for import
|
||||
tempFileTemplate = template.Must(template.New("temp").Parse(`package {{.Name}}
|
||||
|
||||
import "git.golang1.ru/softonik/godog"
|
||||
import "github.com/cucumber/godog"
|
||||
|
||||
var _ = godog.Version
|
||||
`))
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/internal/builder"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/internal/builder"
|
||||
)
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {}
|
||||
|
@ -51,7 +51,7 @@ var builderTestFile = `package godogs
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
func thereAreGodogs(available int) error {
|
||||
|
@ -91,7 +91,7 @@ var builderXTestFile = `package godogs_test
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
|
||||
"godogs"
|
||||
)
|
||||
|
@ -138,7 +138,7 @@ func main() {
|
|||
|
||||
var emptyBuilderTestFile = `package godogs
|
||||
|
||||
import "git.golang1.ru/softonik/godog"
|
||||
import "github.com/cucumber/godog"
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {}
|
||||
`
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/spf13/pflag"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
)
|
||||
|
||||
func Test_BindFlagsShouldRespectFlagDefaults(t *testing.T) {
|
||||
|
|
|
@ -48,9 +48,6 @@ type Options struct {
|
|||
// from feature files
|
||||
Tags string
|
||||
|
||||
// Dialect to be used to parse feature files. If not set, default to "en".
|
||||
Dialect string
|
||||
|
||||
// The formatter name
|
||||
Format string
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -1,680 +0,0 @@
|
|||
package formatters
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"git.golang1.ru/softonik/godog/pkg/formatters/ast"
|
||||
)
|
||||
|
||||
func ASTRegister() {
|
||||
formatters.Format("ast", "Prints every feature with runtime statuses + updates ast.", ASTFormatterFunc)
|
||||
}
|
||||
|
||||
// ASTFormatterFunc implements the FormatterFunc for the AST formatter
|
||||
func ASTFormatterFunc(suite string, out io.Writer) formatters.Formatter {
|
||||
return &AST{Base: NewBase(suite, out)}
|
||||
}
|
||||
|
||||
// AST is a formatter for readable output.
|
||||
type AST struct {
|
||||
*Base
|
||||
firstFeature *bool
|
||||
}
|
||||
|
||||
// TestRunStarted is triggered on test start.
|
||||
func (f *AST) TestRunStarted() {
|
||||
f.Base.TestRunStarted()
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
firstFeature := true
|
||||
f.firstFeature = &firstFeature
|
||||
}
|
||||
|
||||
// Feature receives gherkin document.
|
||||
func (f *AST) Feature(gd *messages.GherkinDocument, p string, c []byte) {
|
||||
f.Lock.Lock()
|
||||
if !*f.firstFeature {
|
||||
fmt.Fprintln(f.out, "")
|
||||
}
|
||||
|
||||
*f.firstFeature = false
|
||||
f.Lock.Unlock()
|
||||
|
||||
f.Base.Feature(gd, p, c)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printFeature(gd.Feature)
|
||||
}
|
||||
|
||||
// Pickle takes a gherkin node for formatting.
|
||||
func (f *AST) Pickle(pickle *messages.Pickle) {
|
||||
f.Base.Pickle(pickle)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
if len(pickle.Steps) == 0 {
|
||||
f.printUndefinedPickle(pickle)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Passed captures passed step.
|
||||
func (f *AST) Passed(pickle *messages.Pickle, step *messages.PickleStep, match *formatters.StepDefinition) {
|
||||
f.Base.Passed(pickle, step, match)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printStep(pickle, step)
|
||||
}
|
||||
|
||||
// Skipped captures skipped step.
|
||||
func (f *AST) Skipped(pickle *messages.Pickle, step *messages.PickleStep, match *formatters.StepDefinition) {
|
||||
f.Base.Skipped(pickle, step, match)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printStep(pickle, step)
|
||||
}
|
||||
|
||||
// Undefined captures undefined step.
|
||||
func (f *AST) Undefined(pickle *messages.Pickle, step *messages.PickleStep, match *formatters.StepDefinition) {
|
||||
f.Base.Undefined(pickle, step, match)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printStep(pickle, step)
|
||||
}
|
||||
|
||||
// Failed captures failed step.
|
||||
func (f *AST) Failed(pickle *messages.Pickle, step *messages.PickleStep, match *formatters.StepDefinition, err error) {
|
||||
f.Base.Failed(pickle, step, match, err)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printStep(pickle, step)
|
||||
}
|
||||
|
||||
// Failed captures failed step.
|
||||
func (f *AST) Ambiguous(pickle *messages.Pickle, step *messages.PickleStep, match *formatters.StepDefinition, err error) {
|
||||
f.Base.Ambiguous(pickle, step, match, err)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printStep(pickle, step)
|
||||
}
|
||||
|
||||
// Pending captures pending step.
|
||||
func (f *AST) Pending(pickle *messages.Pickle, step *messages.PickleStep, match *formatters.StepDefinition) {
|
||||
f.Base.Pending(pickle, step, match)
|
||||
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
|
||||
f.printStep(pickle, step)
|
||||
}
|
||||
|
||||
func (f *AST) printFeature(feature *messages.Feature) {
|
||||
fmt.Fprintln(f.out, keywordAndName(feature.Keyword, feature.Name))
|
||||
if strings.TrimSpace(feature.Description) != "" {
|
||||
for _, line := range strings.Split(feature.Description, "\n") {
|
||||
fmt.Fprintln(f.out, s(f.indent)+strings.TrimSpace(line))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *AST) scenarioLengths(pickle *messages.Pickle) (scenarioHeaderLength int, maxLength int) {
|
||||
feature := f.Storage.MustGetFeature(pickle.Uri)
|
||||
astScenario := feature.FindScenario(pickle.AstNodeIds[0])
|
||||
astBackground := feature.FindBackground(pickle.AstNodeIds[0])
|
||||
|
||||
scenarioHeaderLength = f.lengthPickle(astScenario.Keyword, astScenario.Name)
|
||||
maxLength = f.longestStep(astScenario.Steps, scenarioHeaderLength)
|
||||
|
||||
if astBackground != nil {
|
||||
maxLength = f.longestStep(astBackground.Steps, maxLength)
|
||||
}
|
||||
|
||||
return scenarioHeaderLength, maxLength
|
||||
}
|
||||
|
||||
func (f *AST) printScenarioHeader(pickle *messages.Pickle, astScenario *messages.Scenario, spaceFilling int) {
|
||||
feature := f.Storage.MustGetFeature(pickle.Uri)
|
||||
text := s(f.indent) + keywordAndName(astScenario.Keyword, astScenario.Name)
|
||||
text += s(spaceFilling) + line(feature.Uri, astScenario.Location)
|
||||
fmt.Fprintln(f.out, "\n"+text)
|
||||
}
|
||||
|
||||
func (f *AST) printUndefinedPickle(pickle *messages.Pickle) {
|
||||
feature := f.Storage.MustGetFeature(pickle.Uri)
|
||||
astScenario := feature.FindScenario(pickle.AstNodeIds[0])
|
||||
astBackground := feature.FindBackground(pickle.AstNodeIds[0])
|
||||
|
||||
scenarioHeaderLength, maxLength := f.scenarioLengths(pickle)
|
||||
|
||||
if astBackground != nil {
|
||||
fmt.Fprintln(f.out, "\n"+s(f.indent)+keywordAndName(astBackground.Keyword, astBackground.Name))
|
||||
for _, step := range astBackground.Steps {
|
||||
text := s(f.indent*2) + cyan(strings.TrimSpace(step.Keyword)) + " " + cyan(step.Text)
|
||||
fmt.Fprintln(f.out, text)
|
||||
}
|
||||
}
|
||||
|
||||
// do not print scenario headers and examples multiple times
|
||||
if len(astScenario.Examples) > 0 {
|
||||
exampleTable, exampleRow := feature.FindExample(pickle.AstNodeIds[1])
|
||||
firstExampleRow := exampleTable.TableBody[0].Id == exampleRow.Id
|
||||
firstExamplesTable := astScenario.Examples[0].Location.Line == exampleTable.Location.Line
|
||||
|
||||
if !(firstExamplesTable && firstExampleRow) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
f.printScenarioHeader(pickle, astScenario, maxLength-scenarioHeaderLength)
|
||||
|
||||
for _, examples := range astScenario.Examples {
|
||||
max := longestExampleRow(examples, cyan, cyan)
|
||||
|
||||
fmt.Fprintln(f.out, "")
|
||||
fmt.Fprintln(f.out, s(f.indent*2)+keywordAndName(examples.Keyword, examples.Name))
|
||||
|
||||
f.printTableHeader(examples.TableHeader, max)
|
||||
|
||||
for _, row := range examples.TableBody {
|
||||
f.printTableRow(row, max, cyan)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Summary renders summary information.
|
||||
func (f *AST) Summary() {
|
||||
failedStepResults := f.Storage.MustGetPickleStepResultsByStatus(failed)
|
||||
if len(failedStepResults) > 0 {
|
||||
fmt.Fprintln(f.out, "\n--- "+red("Failed steps:")+"\n")
|
||||
|
||||
sort.Sort(sortPickleStepResultsByPickleStepID(failedStepResults))
|
||||
|
||||
for _, fail := range failedStepResults {
|
||||
pickle := f.Storage.MustGetPickle(fail.PickleID)
|
||||
pickleStep := f.Storage.MustGetPickleStep(fail.PickleStepID)
|
||||
feature := f.Storage.MustGetFeature(pickle.Uri)
|
||||
|
||||
astScenario := feature.FindScenario(pickle.AstNodeIds[0])
|
||||
scenarioDesc := fmt.Sprintf("%s: %s", astScenario.Keyword, pickle.Name)
|
||||
|
||||
astStep := feature.FindStep(pickleStep.AstNodeIds[0])
|
||||
stepDesc := strings.TrimSpace(astStep.Keyword) + " " + pickleStep.Text
|
||||
|
||||
fmt.Fprintln(f.out, s(f.indent)+red(scenarioDesc)+line(feature.Uri, astScenario.Location))
|
||||
fmt.Fprintln(f.out, s(f.indent*2)+red(stepDesc)+line(feature.Uri, astStep.Location))
|
||||
fmt.Fprint(f.out, s(f.indent*3)+redb(fmt.Sprintf("%+v", fail.Err)))
|
||||
}
|
||||
}
|
||||
|
||||
f.SummaryBottom()
|
||||
}
|
||||
func (f *AST) SummaryBottom() {
|
||||
var totalSc, passedSc, undefinedSc int
|
||||
var totalSt, passedSt, failedSt, skippedSt, pendingSt, undefinedSt, ambiguousSt int
|
||||
|
||||
pickleResults := f.Storage.MustGetPickleResults()
|
||||
for _, pr := range pickleResults {
|
||||
var prStatus models.StepResultStatus
|
||||
totalSc++
|
||||
|
||||
pickleStepResults := f.Storage.MustGetPickleStepResultsByPickleID(pr.PickleID)
|
||||
|
||||
if len(pickleStepResults) == 0 {
|
||||
prStatus = undefined
|
||||
}
|
||||
|
||||
for _, sr := range pickleStepResults {
|
||||
totalSt++
|
||||
|
||||
switch sr.Status {
|
||||
case passed:
|
||||
passedSt++
|
||||
case failed:
|
||||
prStatus = failed
|
||||
failedSt++
|
||||
case ambiguous:
|
||||
prStatus = ambiguous
|
||||
ambiguousSt++
|
||||
case skipped:
|
||||
skippedSt++
|
||||
case undefined:
|
||||
prStatus = undefined
|
||||
undefinedSt++
|
||||
case pending:
|
||||
prStatus = pending
|
||||
pendingSt++
|
||||
}
|
||||
}
|
||||
|
||||
if prStatus == passed {
|
||||
passedSc++
|
||||
} else if prStatus == undefined {
|
||||
undefinedSc++
|
||||
}
|
||||
}
|
||||
|
||||
var steps, parts, scenarios []string
|
||||
if passedSt > 0 {
|
||||
steps = append(steps, green(fmt.Sprintf("%d passed", passedSt)))
|
||||
}
|
||||
if failedSt > 0 {
|
||||
parts = append(parts, red(fmt.Sprintf("%d failed", failedSt)))
|
||||
steps = append(steps, red(fmt.Sprintf("%d failed", failedSt)))
|
||||
}
|
||||
if pendingSt > 0 {
|
||||
parts = append(parts, yellow(fmt.Sprintf("%d pending", pendingSt)))
|
||||
steps = append(steps, yellow(fmt.Sprintf("%d pending", pendingSt)))
|
||||
}
|
||||
if ambiguousSt > 0 {
|
||||
parts = append(parts, yellow(fmt.Sprintf("%d ambiguous", ambiguousSt)))
|
||||
steps = append(steps, yellow(fmt.Sprintf("%d ambiguous", ambiguousSt)))
|
||||
}
|
||||
if undefinedSt > 0 {
|
||||
parts = append(parts, yellow(fmt.Sprintf("%d undefined", undefinedSc)))
|
||||
steps = append(steps, yellow(fmt.Sprintf("%d undefined", undefinedSt)))
|
||||
} else if undefinedSc > 0 {
|
||||
// there may be some scenarios without steps
|
||||
parts = append(parts, yellow(fmt.Sprintf("%d undefined", undefinedSc)))
|
||||
}
|
||||
if skippedSt > 0 {
|
||||
steps = append(steps, cyan(fmt.Sprintf("%d skipped", skippedSt)))
|
||||
}
|
||||
if passedSc > 0 {
|
||||
scenarios = append(scenarios, green(fmt.Sprintf("%d passed", passedSc)))
|
||||
}
|
||||
scenarios = append(scenarios, parts...)
|
||||
|
||||
testRunStartedAt := f.Storage.MustGetTestRunStarted().StartedAt
|
||||
elapsed := utils.TimeNowFunc().Sub(testRunStartedAt)
|
||||
|
||||
fmt.Fprintln(f.out, "")
|
||||
|
||||
if totalSc == 0 {
|
||||
fmt.Fprintln(f.out, "No scenarios")
|
||||
} else {
|
||||
fmt.Fprintf(f.out, "%d scenarios (%s), ", totalSc, strings.Join(scenarios, ", "))
|
||||
}
|
||||
|
||||
if totalSt == 0 {
|
||||
fmt.Fprintln(f.out, "No steps")
|
||||
} else {
|
||||
fmt.Fprintf(f.out, "%d steps (%s)\n", totalSt, strings.Join(steps, ", "))
|
||||
}
|
||||
|
||||
elapsedString := elapsed.String()
|
||||
if elapsed.Nanoseconds() == 0 {
|
||||
// go 1.5 and 1.6 prints 0 instead of 0s, if duration is zero.
|
||||
elapsedString = "0s"
|
||||
}
|
||||
fmt.Fprintln(f.out, elapsedString)
|
||||
|
||||
// prints used randomization seed
|
||||
seed, err := strconv.ParseInt(os.Getenv("GODOG_SEED"), 10, 64)
|
||||
if err == nil && seed != 0 {
|
||||
fmt.Fprintln(f.out, "")
|
||||
fmt.Fprintln(f.out, "Randomized with seed:", colors.Yellow(seed))
|
||||
}
|
||||
|
||||
if text := f.Snippets(); text != "" {
|
||||
fmt.Fprintln(f.out, "")
|
||||
fmt.Fprintln(f.out, yellow("You can implement step definitions for undefined steps with these snippets:"))
|
||||
fmt.Fprintln(f.out, yellow(text))
|
||||
}
|
||||
}
|
||||
|
||||
func (f *AST) Snippets() string {
|
||||
undefinedStepResults := f.Storage.MustGetPickleStepResultsByStatus(undefined)
|
||||
if len(undefinedStepResults) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
var index int
|
||||
var snips []undefinedSnippet
|
||||
// build snippets
|
||||
for _, u := range undefinedStepResults {
|
||||
pickleStep := f.Storage.MustGetPickleStep(u.PickleStepID)
|
||||
|
||||
steps := []string{pickleStep.Text}
|
||||
arg := pickleStep.Argument
|
||||
if u.Def != nil {
|
||||
steps = u.Def.Undefined
|
||||
arg = nil
|
||||
}
|
||||
for _, step := range steps {
|
||||
expr := snippetExprCleanup.ReplaceAllString(step, "\\$1")
|
||||
expr = snippetNumbers.ReplaceAllString(expr, "(\\d+)")
|
||||
expr = snippetExprQuoted.ReplaceAllString(expr, "$1\"([^\"]*)\"$2")
|
||||
expr = "^" + strings.TrimSpace(expr) + "$"
|
||||
|
||||
name := snippetNumbers.ReplaceAllString(step, " ")
|
||||
name = snippetExprQuoted.ReplaceAllString(name, " ")
|
||||
name = strings.TrimSpace(snippetMethodName.ReplaceAllString(name, ""))
|
||||
var words []string
|
||||
for i, w := range strings.Split(name, " ") {
|
||||
switch {
|
||||
case i != 0:
|
||||
w = strings.Title(w)
|
||||
case len(w) > 0:
|
||||
r := []rune(w)
|
||||
w = string(unicode.ToLower(r[0])) + string(r[1:])
|
||||
}
|
||||
words = append(words, w)
|
||||
}
|
||||
name = strings.Join(words, "")
|
||||
if len(name) == 0 {
|
||||
index++
|
||||
name = fmt.Sprintf("StepDefinitioninition%d", index)
|
||||
}
|
||||
|
||||
var found bool
|
||||
for _, snip := range snips {
|
||||
if snip.Expr == expr {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
s := undefinedSnippet{Method: name, Expr: expr, argument: arg}
|
||||
snips = append(snips, s)
|
||||
ast.ДобавитьШаг("`"+expr+"`", name, s.Args())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := AST_undefinedSnippetsTpl.Execute(&buf, snips); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// there may be trailing spaces
|
||||
return strings.Replace(buf.String(), " \n", "\n", -1)
|
||||
}
|
||||
|
||||
var AST_undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetHelperFuncs).Parse(`
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {}
|
||||
// ---
|
||||
|
||||
|
||||
{{ range . }}func {{ .Method }}({{ .Args }}) {
|
||||
}
|
||||
{{end}}{{ range . }}
|
||||
ctx.Step({{ backticked .Expr }}, {{ .Method }}){{end}}
|
||||
|
||||
`))
|
||||
|
||||
func (f *AST) printOutlineExample(pickle *messages.Pickle, step *messages.PickleStep, backgroundSteps int) {
|
||||
var errorMsg string
|
||||
var clr = green
|
||||
|
||||
feature := f.Storage.MustGetFeature(pickle.Uri)
|
||||
astScenario := feature.FindScenario(pickle.AstNodeIds[0])
|
||||
scenarioHeaderLength, maxLength := f.scenarioLengths(pickle)
|
||||
|
||||
exampleTable, exampleRow := feature.FindExample(pickle.AstNodeIds[1])
|
||||
printExampleHeader := exampleTable.TableBody[0].Id == exampleRow.Id
|
||||
firstExamplesTable := astScenario.Examples[0].Location.Line == exampleTable.Location.Line
|
||||
|
||||
pickleStepResults := f.Storage.MustGetPickleStepResultsByPickleIDUntilStep(pickle.Id, step.Id)
|
||||
|
||||
firstExecutedScenarioStep := len(pickleStepResults) == backgroundSteps+1
|
||||
if firstExamplesTable && printExampleHeader && firstExecutedScenarioStep {
|
||||
f.printScenarioHeader(pickle, astScenario, maxLength-scenarioHeaderLength)
|
||||
}
|
||||
|
||||
if len(exampleTable.TableBody) == 0 {
|
||||
// do not print empty examples
|
||||
return
|
||||
}
|
||||
|
||||
lastStep := len(pickleStepResults) == len(pickle.Steps)
|
||||
if !lastStep {
|
||||
// do not print examples unless all steps has finished
|
||||
return
|
||||
}
|
||||
|
||||
for _, result := range pickleStepResults {
|
||||
// determine example row status
|
||||
switch {
|
||||
case result.Status == failed:
|
||||
errorMsg = result.Err.Error()
|
||||
clr = result.Status.Color()
|
||||
case result.Status == ambiguous:
|
||||
errorMsg = result.Err.Error()
|
||||
clr = result.Status.Color()
|
||||
case result.Status == undefined || result.Status == pending:
|
||||
clr = result.Status.Color()
|
||||
case result.Status == skipped && clr == nil:
|
||||
clr = cyan
|
||||
}
|
||||
|
||||
if firstExamplesTable && printExampleHeader {
|
||||
// in first example, we need to print steps
|
||||
|
||||
pickleStep := f.Storage.MustGetPickleStep(result.PickleStepID)
|
||||
astStep := feature.FindStep(pickleStep.AstNodeIds[0])
|
||||
|
||||
var text = ""
|
||||
if result.Def != nil {
|
||||
if m := outlinePlaceholderRegexp.FindAllStringIndex(astStep.Text, -1); len(m) > 0 {
|
||||
var pos int
|
||||
for i := 0; i < len(m); i++ {
|
||||
pair := m[i]
|
||||
text += cyan(astStep.Text[pos:pair[0]])
|
||||
text += cyanb(astStep.Text[pair[0]:pair[1]])
|
||||
pos = pair[1]
|
||||
}
|
||||
text += cyan(astStep.Text[pos:len(astStep.Text)])
|
||||
} else {
|
||||
text = cyan(astStep.Text)
|
||||
}
|
||||
|
||||
_, maxLength := f.scenarioLengths(pickle)
|
||||
stepLength := f.lengthPickleStep(astStep.Keyword, astStep.Text)
|
||||
|
||||
text += s(maxLength - stepLength)
|
||||
text += " " + blackb("# "+DefinitionID(result.Def))
|
||||
}
|
||||
|
||||
// print the step outline
|
||||
fmt.Fprintln(f.out, s(f.indent*2)+cyan(strings.TrimSpace(astStep.Keyword))+" "+text)
|
||||
|
||||
if pickleStep.Argument != nil {
|
||||
if table := pickleStep.Argument.DataTable; table != nil {
|
||||
f.printTable(table, cyan)
|
||||
}
|
||||
|
||||
if docString := astStep.DocString; docString != nil {
|
||||
f.printDocString(docString)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
max := longestExampleRow(exampleTable, clr, cyan)
|
||||
|
||||
// an example table header
|
||||
if printExampleHeader {
|
||||
fmt.Fprintln(f.out, "")
|
||||
fmt.Fprintln(f.out, s(f.indent*2)+keywordAndName(exampleTable.Keyword, exampleTable.Name))
|
||||
|
||||
f.printTableHeader(exampleTable.TableHeader, max)
|
||||
}
|
||||
|
||||
f.printTableRow(exampleRow, max, clr)
|
||||
|
||||
if errorMsg != "" {
|
||||
fmt.Fprintln(f.out, s(f.indent*4)+redb(errorMsg))
|
||||
}
|
||||
}
|
||||
|
||||
func (f *AST) printTableRow(row *messages.TableRow, max []int, clr colors.ColorFunc) {
|
||||
cells := make([]string, len(row.Cells))
|
||||
|
||||
for i, cell := range row.Cells {
|
||||
val := clr(cell.Value)
|
||||
ln := utf8.RuneCountInString(val)
|
||||
cells[i] = val + s(max[i]-ln)
|
||||
}
|
||||
|
||||
fmt.Fprintln(f.out, s(f.indent*3)+"| "+strings.Join(cells, " | ")+" |")
|
||||
}
|
||||
|
||||
func (f *AST) printTableHeader(row *messages.TableRow, max []int) {
|
||||
f.printTableRow(row, max, cyan)
|
||||
}
|
||||
|
||||
func (f *AST) printStep(pickle *messages.Pickle, pickleStep *messages.PickleStep) {
|
||||
feature := f.Storage.MustGetFeature(pickle.Uri)
|
||||
astBackground := feature.FindBackground(pickle.AstNodeIds[0])
|
||||
astScenario := feature.FindScenario(pickle.AstNodeIds[0])
|
||||
astRule := feature.FindRule(pickle.AstNodeIds[0])
|
||||
astStep := feature.FindStep(pickleStep.AstNodeIds[0])
|
||||
|
||||
var astBackgroundStep bool
|
||||
var firstExecutedBackgroundStep bool
|
||||
var backgroundSteps int
|
||||
|
||||
if astBackground != nil {
|
||||
backgroundSteps = len(astBackground.Steps)
|
||||
|
||||
for idx, step := range astBackground.Steps {
|
||||
if step.Id == pickleStep.AstNodeIds[0] {
|
||||
astBackgroundStep = true
|
||||
firstExecutedBackgroundStep = idx == 0
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
firstPickle := isFirstPickleAndNoRule(feature, pickle, astRule) || isFirstScenarioInRule(astRule, astScenario)
|
||||
|
||||
if astBackgroundStep && !firstPickle {
|
||||
return
|
||||
}
|
||||
|
||||
if astBackgroundStep && firstExecutedBackgroundStep {
|
||||
fmt.Fprintln(f.out, "\n"+s(f.indent)+keywordAndName(astBackground.Keyword, astBackground.Name))
|
||||
}
|
||||
|
||||
if !astBackgroundStep && len(astScenario.Examples) > 0 {
|
||||
f.printOutlineExample(pickle, pickleStep, backgroundSteps)
|
||||
return
|
||||
}
|
||||
|
||||
scenarioHeaderLength, maxLength := f.scenarioLengths(pickle)
|
||||
stepLength := f.lengthPickleStep(astStep.Keyword, pickleStep.Text)
|
||||
|
||||
firstExecutedScenarioStep := astScenario.Steps[0].Id == pickleStep.AstNodeIds[0]
|
||||
if !astBackgroundStep && firstExecutedScenarioStep {
|
||||
f.printScenarioHeader(pickle, astScenario, maxLength-scenarioHeaderLength)
|
||||
}
|
||||
|
||||
pickleStepResult := f.Storage.MustGetPickleStepResult(pickleStep.Id)
|
||||
text := s(f.indent*2) + pickleStepResult.Status.Color()(strings.TrimSpace(astStep.Keyword)) + " " + pickleStepResult.Status.Color()(pickleStep.Text)
|
||||
if pickleStepResult.Def != nil {
|
||||
text += s(maxLength - stepLength + 1)
|
||||
text += blackb("# " + DefinitionID(pickleStepResult.Def))
|
||||
}
|
||||
fmt.Fprintln(f.out, text)
|
||||
|
||||
if pickleStep.Argument != nil {
|
||||
if table := pickleStep.Argument.DataTable; table != nil {
|
||||
f.printTable(table, cyan)
|
||||
}
|
||||
|
||||
if docString := astStep.DocString; docString != nil {
|
||||
f.printDocString(docString)
|
||||
}
|
||||
}
|
||||
|
||||
if pickleStepResult.Err != nil {
|
||||
fmt.Fprintln(f.out, s(f.indent*2)+redb(fmt.Sprintf("%+v", pickleStepResult.Err)))
|
||||
}
|
||||
|
||||
if pickleStepResult.Status == pending {
|
||||
fmt.Fprintln(f.out, s(f.indent*3)+yellow("TODO: write pending definition"))
|
||||
}
|
||||
}
|
||||
|
||||
func (f *AST) printDocString(docString *messages.DocString) {
|
||||
var ct string
|
||||
|
||||
if len(docString.MediaType) > 0 {
|
||||
ct = " " + cyan(docString.MediaType)
|
||||
}
|
||||
|
||||
fmt.Fprintln(f.out, s(f.indent*3)+cyan(docString.Delimiter)+ct)
|
||||
|
||||
for _, ln := range strings.Split(docString.Content, "\n") {
|
||||
fmt.Fprintln(f.out, s(f.indent*3)+cyan(ln))
|
||||
}
|
||||
|
||||
fmt.Fprintln(f.out, s(f.indent*3)+cyan(docString.Delimiter))
|
||||
}
|
||||
|
||||
// print table with aligned table cells
|
||||
// @TODO: need to make example header cells bold
|
||||
func (f *AST) printTable(t *messages.PickleTable, c colors.ColorFunc) {
|
||||
maxColLengths := maxColLengths(t, c)
|
||||
var cols = make([]string, len(t.Rows[0].Cells))
|
||||
|
||||
for _, row := range t.Rows {
|
||||
for i, cell := range row.Cells {
|
||||
val := c(cell.Value)
|
||||
colLength := utf8.RuneCountInString(val)
|
||||
cols[i] = val + s(maxColLengths[i]-colLength)
|
||||
}
|
||||
|
||||
fmt.Fprintln(f.out, s(f.indent*3)+"| "+strings.Join(cols, " | ")+" |")
|
||||
}
|
||||
}
|
||||
|
||||
func (f *AST) longestStep(steps []*messages.Step, pickleLength int) int {
|
||||
max := pickleLength
|
||||
|
||||
for _, step := range steps {
|
||||
length := f.lengthPickleStep(step.Keyword, step.Text)
|
||||
if length > max {
|
||||
max = length
|
||||
}
|
||||
}
|
||||
|
||||
return max
|
||||
}
|
||||
|
||||
func (f *AST) lengthPickleStep(keyword, text string) int {
|
||||
return f.indent*2 + utf8.RuneCountInString(strings.TrimSpace(keyword)+" "+text)
|
||||
}
|
||||
|
||||
func (f *AST) lengthPickle(keyword, name string) int {
|
||||
return f.indent + utf8.RuneCountInString(strings.TrimSpace(keyword)+": "+name)
|
||||
}
|
|
@ -13,11 +13,11 @@ import (
|
|||
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/storage"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/storage"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
)
|
||||
|
||||
// BaseFormatterFunc implements the FormatterFunc for the base formatter.
|
||||
|
@ -238,8 +238,7 @@ func (f *Base) Snippets() string {
|
|||
case i != 0:
|
||||
w = strings.Title(w)
|
||||
case len(w) > 0:
|
||||
r := []rune(w)
|
||||
w = string(unicode.ToLower(r[0])) + string(r[1:])
|
||||
w = string(unicode.ToLower(rune(w[0]))) + w[1:]
|
||||
}
|
||||
words = append(words, w)
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -42,7 +42,7 @@ And step failed f2s3:4
|
|||
|
||||
Scenario: f2s4
|
||||
When step passed f2s4:1
|
||||
Then something unknown happens f2s4:2
|
||||
Then step is undefined f2s4:2
|
||||
And step passed f2s4:3
|
||||
`)},
|
||||
)
|
||||
|
@ -116,8 +116,8 @@ scenario "f2s3" passed
|
|||
|
||||
step invoked: "f2s4:1", passed
|
||||
step "step passed f2s4:1" finished with status passed
|
||||
.Ustep "something unknown happens f2s4:2" finished with status undefined
|
||||
scenario "f2s4" ended with error "step is undefined: something unknown happens f2s4:2"
|
||||
.Ustep "step is undefined f2s4:2" finished with status undefined
|
||||
scenario "f2s4" ended with error "step is undefined"
|
||||
-step "step passed f2s4:3" finished with status skipped
|
||||
13
|
||||
|
||||
|
@ -139,12 +139,12 @@ scenario "f2s4" ended with error "step is undefined: something unknown happens f
|
|||
|
||||
You can implement step definitions for undefined steps with these snippets:
|
||||
|
||||
func somethingUnknownHappensFS(arg1, arg2, arg3 int) error {
|
||||
func stepIsUndefinedFS(arg1, arg2, arg3 int) error {
|
||||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`+"`"+`^something unknown happens f(\d+)s(\d+):(\d+)$`+"`"+`, somethingUnknownHappensFS)
|
||||
ctx.Step(`+"`"+`^step is undefined f(\d+)s(\d+):(\d+)$`+"`"+`, stepIsUndefinedFS)
|
||||
}
|
||||
|
||||
`, out.String())
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"github.com/cucumber/godog/colors"
|
||||
)
|
||||
|
||||
type csiState int
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
package formatters
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
// WrapOnFlush wrap a `formatters.Formatter` in a `formatters.FlushFormatter`, which only
|
||||
// executes when `Flush` is called
|
||||
func WrapOnFlush(fmt formatters.Formatter) formatters.FlushFormatter {
|
||||
return &onFlushFormatter{
|
||||
fmt: fmt,
|
||||
fns: make([]func(), 0),
|
||||
mu: &sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
type onFlushFormatter struct {
|
||||
fmt formatters.Formatter
|
||||
fns []func()
|
||||
mu *sync.Mutex
|
||||
}
|
||||
|
||||
func (o *onFlushFormatter) Pickle(pickle *messages.Pickle) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Pickle(pickle)
|
||||
})
|
||||
}
|
||||
|
||||
func (o *onFlushFormatter) Passed(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Passed(pickle, step, definition)
|
||||
})
|
||||
}
|
||||
|
||||
// Ambiguous implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Ambiguous(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition, err error) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Ambiguous(pickle, step, definition, err)
|
||||
})
|
||||
}
|
||||
|
||||
// Defined implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Defined(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Defined(pickle, step, definition)
|
||||
})
|
||||
}
|
||||
|
||||
// Failed implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Failed(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition, err error) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Failed(pickle, step, definition, err)
|
||||
})
|
||||
}
|
||||
|
||||
// Feature implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Feature(pickle *messages.GherkinDocument, p string, c []byte) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Feature(pickle, p, c)
|
||||
})
|
||||
}
|
||||
|
||||
// Pending implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Pending(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Pending(pickle, step, definition)
|
||||
})
|
||||
}
|
||||
|
||||
// Skipped implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Skipped(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Skipped(pickle, step, definition)
|
||||
})
|
||||
}
|
||||
|
||||
// Summary implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Summary() {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Summary()
|
||||
})
|
||||
}
|
||||
|
||||
// TestRunStarted implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) TestRunStarted() {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.TestRunStarted()
|
||||
})
|
||||
}
|
||||
|
||||
// Undefined implements formatters.Formatter.
|
||||
func (o *onFlushFormatter) Undefined(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
|
||||
o.fns = append(o.fns, func() {
|
||||
o.fmt.Undefined(pickle, step, definition)
|
||||
})
|
||||
}
|
||||
|
||||
// Flush the logs.
|
||||
func (o *onFlushFormatter) Flush() {
|
||||
o.mu.Lock()
|
||||
defer o.mu.Unlock()
|
||||
for _, fn := range o.fns {
|
||||
fn()
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package formatters
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var flushMock = DummyFormatter{}
|
||||
|
||||
func TestFlushWrapOnFormatter(t *testing.T) {
|
||||
flushMock.tt = t
|
||||
|
||||
fmt := WrapOnFlush(&flushMock)
|
||||
|
||||
fmt.Feature(document, str, byt)
|
||||
fmt.TestRunStarted()
|
||||
fmt.Pickle(pickle)
|
||||
fmt.Defined(pickle, step, definition)
|
||||
fmt.Passed(pickle, step, definition)
|
||||
fmt.Skipped(pickle, step, definition)
|
||||
fmt.Undefined(pickle, step, definition)
|
||||
fmt.Failed(pickle, step, definition, err)
|
||||
fmt.Pending(pickle, step, definition)
|
||||
fmt.Ambiguous(pickle, step, definition, err)
|
||||
fmt.Summary()
|
||||
|
||||
assert.Equal(t, 0, flushMock.CountFeature)
|
||||
assert.Equal(t, 0, flushMock.CountTestRunStarted)
|
||||
assert.Equal(t, 0, flushMock.CountPickle)
|
||||
assert.Equal(t, 0, flushMock.CountDefined)
|
||||
assert.Equal(t, 0, flushMock.CountPassed)
|
||||
assert.Equal(t, 0, flushMock.CountSkipped)
|
||||
assert.Equal(t, 0, flushMock.CountUndefined)
|
||||
assert.Equal(t, 0, flushMock.CountFailed)
|
||||
assert.Equal(t, 0, flushMock.CountPending)
|
||||
assert.Equal(t, 0, flushMock.CountAmbiguous)
|
||||
assert.Equal(t, 0, flushMock.CountSummary)
|
||||
|
||||
fmt.Flush()
|
||||
|
||||
assert.Equal(t, 1, flushMock.CountFeature)
|
||||
assert.Equal(t, 1, flushMock.CountTestRunStarted)
|
||||
assert.Equal(t, 1, flushMock.CountPickle)
|
||||
assert.Equal(t, 1, flushMock.CountDefined)
|
||||
assert.Equal(t, 1, flushMock.CountPassed)
|
||||
assert.Equal(t, 1, flushMock.CountSkipped)
|
||||
assert.Equal(t, 1, flushMock.CountUndefined)
|
||||
assert.Equal(t, 1, flushMock.CountFailed)
|
||||
assert.Equal(t, 1, flushMock.CountPending)
|
||||
assert.Equal(t, 1, flushMock.CountAmbiguous)
|
||||
assert.Equal(t, 1, flushMock.CountSummary)
|
||||
}
|
|
@ -9,8 +9,8 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -3,8 +3,8 @@ package formatters
|
|||
import (
|
||||
"io"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/storage"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/storage"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
@ -24,6 +24,7 @@ var (
|
|||
|
||||
// TestRepeater tests the delegation of the repeater functions.
|
||||
func TestRepeater(t *testing.T) {
|
||||
|
||||
mock.tt = t
|
||||
f := make(repeater, 0)
|
||||
f = append(f, &mock)
|
||||
|
@ -51,6 +52,7 @@ func TestRepeater(t *testing.T) {
|
|||
assert.Equal(t, 2, mock.CountFailed)
|
||||
assert.Equal(t, 2, mock.CountPending)
|
||||
assert.Equal(t, 2, mock.CountAmbiguous)
|
||||
|
||||
}
|
||||
|
||||
type BaseFormatter struct {
|
||||
|
@ -71,7 +73,6 @@ type DummyFormatter struct {
|
|||
CountFailed int
|
||||
CountPending int
|
||||
CountAmbiguous int
|
||||
CountSummary int
|
||||
}
|
||||
|
||||
// SetStorage assigns gherkin data storage.
|
||||
|
@ -157,8 +158,3 @@ func (f *DummyFormatter) Ambiguous(p *messages.Pickle, s *messages.PickleStep, d
|
|||
assert.Equal(f.tt, d, definition)
|
||||
f.CountAmbiguous++
|
||||
}
|
||||
|
||||
// Pickle receives scenario.
|
||||
func (f *DummyFormatter) Summary() {
|
||||
f.CountSummary++
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"github.com/cucumber/godog"
|
||||
)
|
||||
|
||||
const fmtOutputTestsFeatureDir = "formatter-tests/features"
|
||||
|
@ -24,7 +24,7 @@ var tT *testing.T
|
|||
func Test_FmtOutput(t *testing.T) {
|
||||
tT = t
|
||||
pkg := os.Getenv("GODOG_TESTED_PACKAGE")
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", "git.golang1.ru/softonik/godog")
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", "github.com/cucumber/godog")
|
||||
|
||||
featureFiles, err := listFmtOutputTestsFeatureFiles()
|
||||
require.Nil(t, err)
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -243,7 +243,7 @@ func (f *Pretty) Summary() {
|
|||
f.Base.Summary()
|
||||
}
|
||||
|
||||
func (f *Pretty) printOutlineExample(pickle *messages.Pickle, step *messages.PickleStep, backgroundSteps int) {
|
||||
func (f *Pretty) printOutlineExample(pickle *messages.Pickle, backgroundSteps int) {
|
||||
var errorMsg string
|
||||
var clr = green
|
||||
|
||||
|
@ -255,7 +255,7 @@ func (f *Pretty) printOutlineExample(pickle *messages.Pickle, step *messages.Pic
|
|||
printExampleHeader := exampleTable.TableBody[0].Id == exampleRow.Id
|
||||
firstExamplesTable := astScenario.Examples[0].Location.Line == exampleTable.Location.Line
|
||||
|
||||
pickleStepResults := f.Storage.MustGetPickleStepResultsByPickleIDUntilStep(pickle.Id, step.Id)
|
||||
pickleStepResults := f.Storage.MustGetPickleStepResultsByPickleID(pickle.Id)
|
||||
|
||||
firstExecutedScenarioStep := len(pickleStepResults) == backgroundSteps+1
|
||||
if firstExamplesTable && printExampleHeader && firstExecutedScenarioStep {
|
||||
|
@ -419,7 +419,7 @@ func (f *Pretty) printStep(pickle *messages.Pickle, pickleStep *messages.PickleS
|
|||
}
|
||||
|
||||
if !astBackgroundStep && len(astScenario.Examples) > 0 {
|
||||
f.printOutlineExample(pickle, pickleStep, backgroundSteps)
|
||||
f.printOutlineExample(pickle, backgroundSteps)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
|
@ -42,7 +42,7 @@ func (f *Progress) Summary() {
|
|||
left := math.Mod(float64(*f.Steps), float64(f.StepsPerRow))
|
||||
if left != 0 {
|
||||
if *f.Steps > f.StepsPerRow {
|
||||
fmt.Fprint(f.out, s(f.StepsPerRow-int(left))+fmt.Sprintf(" %d\n", *f.Steps))
|
||||
fmt.Fprintf(f.out, s(f.StepsPerRow-int(left))+fmt.Sprintf(" %d\n", *f.Steps))
|
||||
} else {
|
||||
fmt.Fprintf(f.out, " %d\n", *f.Steps)
|
||||
}
|
||||
|
|
|
@ -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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:103 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:103 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:103 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:103 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:103 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:103 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:103 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:103 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:6","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:7","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:103 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_outline.feature:8","definition_id":"fmt_output_test.go:103 -\u003e github.com/cucumber/godog/internal/formatters_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,7 +1,7 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/scenario_with_attachment.feature:1","source":"Feature: feature with attachment\n describes\n an attachment\n feature\n\n Scenario: scenario with attachment\n Given a step with a single attachment call for multiple attachments\n And a step with multiple attachment calls\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/scenario_with_attachment.feature:6","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_attachment.feature:7","definition_id":"fmt_output_test.go:XXX -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.stepWithSingleAttachmentCall","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_attachment.feature:7","definition_id":"fmt_output_test.go:XXX -\u003e github.com/cucumber/godog/internal/formatters_test.stepWithSingleAttachmentCall","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871}
|
||||
{"event":"Attachment","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871,"contentEncoding":"BASE64","fileName":"Before Scenario Attachment 1","mimeType":"text/plain","body":"BeforeScenarioAttachment"}
|
||||
{"event":"Attachment","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871,"contentEncoding":"BASE64","fileName":"Before Step Attachment 3","mimeType":"text/plain","body":"BeforeStepAttachment"}
|
||||
|
@ -9,7 +9,7 @@
|
|||
{"event":"Attachment","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871,"contentEncoding":"BASE64","fileName":"TheFilename2","mimeType":"text/plain","body":"TheData2"}
|
||||
{"event":"Attachment","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871,"contentEncoding":"BASE64","fileName":"After Step Attachment 4","mimeType":"text/plain","body":"AfterStepAttachment"}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_attachment.feature:8","definition_id":"fmt_output_test.go:XXX -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.stepWithMultipleAttachmentCalls","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_attachment.feature:8","definition_id":"fmt_output_test.go:XXX -\u003e github.com/cucumber/godog/internal/formatters_test.stepWithMultipleAttachmentCalls","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_attachment.feature:8","timestamp":-6795364578871}
|
||||
{"event":"Attachment","location":"formatter-tests/features/scenario_with_attachment.feature:8","timestamp":-6795364578871,"contentEncoding":"BASE64","fileName":"Before Step Attachment 3","mimeType":"text/plain","body":"BeforeStepAttachment"}
|
||||
{"event":"Attachment","location":"formatter-tests/features/scenario_with_attachment.feature:8","timestamp":-6795364578871,"contentEncoding":"BASE64","fileName":"TheFilename3","mimeType":"text/plain","body":"TheData1"}
|
||||
|
|
|
@ -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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:4","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:5","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:8","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/scenario_with_background.feature:9","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/single_scenario_with_passing_step.feature:7","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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,35 +1,35 @@
|
|||
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"}
|
||||
{"event":"TestSource","location":"formatter-tests/features/some_scenarios_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\n Scenario: ambiguous\n When ambiguous step\n Then passing step\n"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:3","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:4","definition_id":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:4","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:4","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:4","timestamp":-6795364578871,"status":"passed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:5","definition_id":"fmt_output_test.go:117 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:5","definition_id":"fmt_output_test.go:117 -\u003e github.com/cucumber/godog/internal/formatters_test.failingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:5","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:5","timestamp":-6795364578871,"status":"failed","summary":"step failed"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:6","definition_id":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:6","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:6","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:6","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:3","timestamp":-6795364578871,"status":"failed"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:8","timestamp":-6795364578871}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:9","definition_id":"fmt_output_test.go:115 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.pendingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:9","definition_id":"fmt_output_test.go:115 -\u003e github.com/cucumber/godog/internal/formatters_test.pendingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:9","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:9","timestamp":-6795364578871,"status":"pending"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:10","definition_id":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:10","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:10","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:10","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:8","timestamp":-6795364578871,"status":"pending"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:12","timestamp":-6795364578871}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:13","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:13","timestamp":-6795364578871,"status":"undefined"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:14","definition_id":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:14","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:14","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:14","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:12","timestamp":-6795364578871,"status":"undefined"}
|
||||
{"event":"TestCaseStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:16","timestamp":-6795364578871}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:17","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:17","timestamp":-6795364578871,"status":"ambiguous","summary":"ambiguous step definition, step text: ambiguous step\n matches:\n ^ambiguous step.*$\n ^ambiguous step$"}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:18","definition_id":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/some_scenarios_including_failing.feature:18","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:18","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:18","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:16","timestamp":-6795364578871,"status":"ambiguous"}
|
||||
|
|
|
@ -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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:117 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","definition_id":"fmt_output_test.go:117 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:8","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:9","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:117 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","definition_id":"fmt_output_test.go:117 -\u003e github.com/cucumber/godog/internal/formatters_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":"fmt_output_test.go:101 -\u003e git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
|
||||
{"event":"StepDefinitionFound","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:12","definition_id":"fmt_output_test.go:101 -\u003e github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_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:103 -> git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef</bold-black>
|
||||
<cyan>Given</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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:103 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="junit,pretty" tests="1" skipped="0" failures="0" errors="0" time="0">
|
||||
<testsuite name="single scenario with background" tests="1" skipped="0" failures="0" errors="0" time="0">
|
||||
|
|
|
@ -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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Given</green> <green>a passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="junit,pretty" tests="1" skipped="0" failures="0" errors="0" time="0">
|
||||
<testsuite name="single passing scenario" tests="1" skipped="0" failures="0" errors="0" time="0">
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<bold-white>Feature:</bold-white> some scenarios
|
||||
|
||||
<bold-white>Scenario:</bold-white> failing <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:3</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>When</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>When</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef</bold-black>
|
||||
<bold-red>step failed</bold-red>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> pending <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:8</bold-black>
|
||||
<yellow>When</yellow> <yellow>pending step</yellow> <bold-black># fmt_output_test.go:115 -> git.golang1.ru/softonik/godog/internal/formatters_test.pendingStepDef</bold-black>
|
||||
<yellow>When</yellow> <yellow>pending step</yellow> <bold-black># fmt_output_test.go:115 -> github.com/cucumber/godog/internal/formatters_test.pendingStepDef</bold-black>
|
||||
<yellow>TODO: write pending definition</yellow>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> undefined <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:12</bold-black>
|
||||
<yellow>When</yellow> <yellow>undefined</yellow>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> ambiguous <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:16</bold-black>
|
||||
<yellow>When</yellow> <yellow>ambiguous step</yellow>
|
||||
|
@ -21,7 +21,7 @@
|
|||
matches:
|
||||
^ambiguous step.*$
|
||||
^ambiguous step$</bold-red>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="junit,pretty" tests="4" skipped="0" failures="1" errors="2" time="0">
|
||||
<testsuite name="some scenarios" tests="4" skipped="0" failures="1" errors="2" time="0">
|
||||
|
|
|
@ -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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>And</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>And</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="junit,pretty" tests="2" skipped="0" failures="2" errors="0" time="0">
|
||||
<testsuite name="two scenarios with background fail" tests="2" skipped="0" failures="2" errors="0" time="0">
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
<bold-white>Feature:</bold-white> rules with examples with backgrounds
|
||||
|
||||
<bold-white>Background:</bold-white> for first rule
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Example:</bold-white> rule 1 example 1 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:9</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Example:</bold-white> rule 1 example 2 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:13</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Background:</bold-white> for second rule
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Example:</bold-white> rule 1 example 1 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:24</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Example:</bold-white> rule 2 example 2 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:28</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
4 scenarios (<green>4 passed</green>)
|
||||
16 steps (<green>16 passed</green>)
|
||||
|
|
|
@ -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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_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:103 -> git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef</bold-black>
|
||||
<cyan>Given</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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:103 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>And</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>When</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Then</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<green>Given</green> <green>a passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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_scenarios_including_failing.feature:3</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>When</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>When</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef</bold-black>
|
||||
<bold-red>step failed</bold-red>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> pending <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:8</bold-black>
|
||||
<yellow>When</yellow> <yellow>pending step</yellow> <bold-black># fmt_output_test.go:115 -> git.golang1.ru/softonik/godog/internal/formatters_test.pendingStepDef</bold-black>
|
||||
<yellow>When</yellow> <yellow>pending step</yellow> <bold-black># fmt_output_test.go:115 -> github.com/cucumber/godog/internal/formatters_test.pendingStepDef</bold-black>
|
||||
<yellow>TODO: write pending definition</yellow>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> undefined <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:12</bold-black>
|
||||
<yellow>When</yellow> <yellow>undefined</yellow>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
<bold-white>Scenario:</bold-white> ambiguous <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:16</bold-black>
|
||||
<yellow>When</yellow> <yellow>ambiguous step</yellow>
|
||||
|
@ -21,7 +21,7 @@
|
|||
matches:
|
||||
^ambiguous step.*$
|
||||
^ambiguous step$</bold-red>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:XXX -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:XXX -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>And</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef</bold-black>
|
||||
<green>Given</green> <green>passing step</green> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<red>And</red> <red>failing step</red> <bold-black># fmt_output_test.go:117 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>When</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_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># fmt_output_test.go:101 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:101 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black>
|
||||
|
||||
--- <red>Failed steps:</red>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
// some snippet formatting regexps
|
||||
var snippetExprCleanup = regexp.MustCompile(`([\/\[\]\(\)\\^\$\.\|\?\*\+\'])`)
|
||||
var snippetExprQuoted = regexp.MustCompile(`(\W|^)"(?:[^"]*)"(\W|$)`)
|
||||
var snippetMethodName = regexp.MustCompile("[^a-zA-Zа-яА-ЯёЁ\\_\\ ]")
|
||||
var snippetMethodName = regexp.MustCompile(`[^a-zA-Z\_\ ]`)
|
||||
var snippetNumbers = regexp.MustCompile(`(\d+)`)
|
||||
|
||||
var snippetHelperFuncs = template.FuncMap{
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
)
|
||||
|
||||
// this zeroes the time throughout whole test suite
|
||||
|
|
|
@ -3,8 +3,8 @@ package models_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/testutils"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/testutils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package models
|
|||
import (
|
||||
"time"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/utils"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/utils"
|
||||
)
|
||||
|
||||
// TestRunStarted ...
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"github.com/cucumber/godog/colors"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
)
|
||||
|
||||
type stepResultStatusTestCase struct {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
)
|
||||
|
||||
var typeOfBytes = reflect.TypeOf([]byte(nil))
|
||||
|
@ -54,7 +54,7 @@ func (sd *StepDefinition) Run(ctx context.Context) (context.Context, interface{}
|
|||
}
|
||||
|
||||
if len(sd.Args) < numIn {
|
||||
return ctx, fmt.Errorf("%w: expected %d arguments, matched %d from step", ErrUnmatchedStepArgumentNumber, numIn, len(sd.Args))
|
||||
return ctx, fmt.Errorf("%w: expected %d arguments, matched %d from step", ErrUnmatchedStepArgumentNumber, typ.NumIn(), len(sd.Args))
|
||||
}
|
||||
|
||||
for i := 0; i < numIn; i++ {
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/formatters"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/cucumber/godog/formatters"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
|
@ -259,26 +259,6 @@ func TestArgumentCountChecks(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestArgumentCountChecksWithContext(t *testing.T) {
|
||||
wasCalled := false
|
||||
fn := func(ctx context.Context, a int, b int) {
|
||||
wasCalled = true
|
||||
}
|
||||
|
||||
def := &models.StepDefinition{
|
||||
StepDefinition: formatters.StepDefinition{
|
||||
Handler: fn,
|
||||
},
|
||||
HandlerValue: reflect.ValueOf(fn),
|
||||
}
|
||||
|
||||
def.Args = []interface{}{"1"}
|
||||
_, err := def.Run(context.Background())
|
||||
assert.False(t, wasCalled)
|
||||
assert.Equal(t, `func expected more arguments than given: expected 2 arguments, matched 1 from step`, err.(error).Error())
|
||||
assert.True(t, errors.Is(err.(error), models.ErrUnmatchedStepArgumentNumber))
|
||||
}
|
||||
|
||||
func TestShouldSupportIntTypes(t *testing.T) {
|
||||
var aActual int64
|
||||
var bActual int32
|
||||
|
|
|
@ -13,9 +13,9 @@ import (
|
|||
gherkin "github.com/cucumber/gherkin/go/v26"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/flags"
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/tags"
|
||||
"github.com/cucumber/godog/internal/flags"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/tags"
|
||||
)
|
||||
|
||||
var pathLineRe = regexp.MustCompile(`:([\d]+)$`)
|
||||
|
@ -33,7 +33,7 @@ func ExtractFeaturePathLine(p string) (string, int) {
|
|||
return retPath, line
|
||||
}
|
||||
|
||||
func parseFeatureFile(fsys fs.FS, path, dialect string, newIDFunc func() string) (*models.Feature, error) {
|
||||
func parseFeatureFile(fsys fs.FS, path string, newIDFunc func() string) (*models.Feature, error) {
|
||||
reader, err := fsys.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -42,7 +42,7 @@ func parseFeatureFile(fsys fs.FS, path, dialect string, newIDFunc func() string)
|
|||
defer reader.Close()
|
||||
|
||||
var buf bytes.Buffer
|
||||
gherkinDocument, err := gherkin.ParseGherkinDocumentForLanguage(io.TeeReader(reader, &buf), dialect, newIDFunc)
|
||||
gherkinDocument, err := gherkin.ParseGherkinDocument(io.TeeReader(reader, &buf), newIDFunc)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - %v", path, err)
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ func parseFeatureFile(fsys fs.FS, path, dialect string, newIDFunc func() string)
|
|||
return &f, nil
|
||||
}
|
||||
|
||||
func parseBytes(path string, feature []byte, dialect string, newIDFunc func() string) (*models.Feature, error) {
|
||||
func parseBytes(path string, feature []byte, newIDFunc func() string) (*models.Feature, error) {
|
||||
reader := bytes.NewReader(feature)
|
||||
|
||||
var buf bytes.Buffer
|
||||
gherkinDocument, err := gherkin.ParseGherkinDocumentForLanguage(io.TeeReader(reader, &buf), dialect, newIDFunc)
|
||||
gherkinDocument, err := gherkin.ParseGherkinDocument(io.TeeReader(reader, &buf), newIDFunc)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - %v", path, err)
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ func parseBytes(path string, feature []byte, dialect string, newIDFunc func() st
|
|||
return &f, nil
|
||||
}
|
||||
|
||||
func parseFeatureDir(fsys fs.FS, dir, dialect string, newIDFunc func() string) ([]*models.Feature, error) {
|
||||
func parseFeatureDir(fsys fs.FS, dir string, newIDFunc func() string) ([]*models.Feature, error) {
|
||||
var features []*models.Feature
|
||||
return features, fs.WalkDir(fsys, dir, func(p string, f fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
|
@ -85,7 +85,7 @@ func parseFeatureDir(fsys fs.FS, dir, dialect string, newIDFunc func() string) (
|
|||
return nil
|
||||
}
|
||||
|
||||
feat, err := parseFeatureFile(fsys, p, dialect, newIDFunc)
|
||||
feat, err := parseFeatureFile(fsys, p, newIDFunc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ func parseFeatureDir(fsys fs.FS, dir, dialect string, newIDFunc func() string) (
|
|||
})
|
||||
}
|
||||
|
||||
func parsePath(fsys fs.FS, path, dialect string, newIDFunc func() string) ([]*models.Feature, error) {
|
||||
func parsePath(fsys fs.FS, path string, newIDFunc func() string) ([]*models.Feature, error) {
|
||||
var features []*models.Feature
|
||||
|
||||
path, line := ExtractFeaturePathLine(path)
|
||||
|
@ -114,10 +114,10 @@ func parsePath(fsys fs.FS, path, dialect string, newIDFunc func() string) ([]*mo
|
|||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
return parseFeatureDir(fsys, path, dialect, newIDFunc)
|
||||
return parseFeatureDir(fsys, path, newIDFunc)
|
||||
}
|
||||
|
||||
ft, err := parseFeatureFile(fsys, path, dialect, newIDFunc)
|
||||
ft, err := parseFeatureFile(fsys, path, newIDFunc)
|
||||
if err != nil {
|
||||
return features, err
|
||||
}
|
||||
|
@ -146,18 +146,14 @@ func parsePath(fsys fs.FS, path, dialect string, newIDFunc func() string) ([]*mo
|
|||
}
|
||||
|
||||
// ParseFeatures ...
|
||||
func ParseFeatures(fsys fs.FS, filter, dialect string, paths []string) ([]*models.Feature, error) {
|
||||
func ParseFeatures(fsys fs.FS, filter string, paths []string) ([]*models.Feature, error) {
|
||||
var order int
|
||||
|
||||
if dialect == "" {
|
||||
dialect = gherkin.DefaultDialect
|
||||
}
|
||||
|
||||
featureIdxs := make(map[string]int)
|
||||
uniqueFeatureURI := make(map[string]*models.Feature)
|
||||
newIDFunc := (&messages.Incrementing{}).NewId
|
||||
for _, path := range paths {
|
||||
feats, err := parsePath(fsys, path, dialect, newIDFunc)
|
||||
feats, err := parsePath(fsys, path, newIDFunc)
|
||||
|
||||
switch {
|
||||
case os.IsNotExist(err):
|
||||
|
@ -186,25 +182,21 @@ func ParseFeatures(fsys fs.FS, filter, dialect string, paths []string) ([]*model
|
|||
features[idx] = feature
|
||||
}
|
||||
|
||||
features = FilterFeatures(filter, features)
|
||||
features = filterFeatures(filter, features)
|
||||
|
||||
return features, nil
|
||||
}
|
||||
|
||||
type FeatureContent = flags.Feature
|
||||
|
||||
func ParseFromBytes(filter, dialect string, featuresInputs []FeatureContent) ([]*models.Feature, error) {
|
||||
func ParseFromBytes(filter string, featuresInputs []FeatureContent) ([]*models.Feature, error) {
|
||||
var order int
|
||||
|
||||
if dialect == "" {
|
||||
dialect = gherkin.DefaultDialect
|
||||
}
|
||||
|
||||
featureIdxs := make(map[string]int)
|
||||
uniqueFeatureURI := make(map[string]*models.Feature)
|
||||
newIDFunc := (&messages.Incrementing{}).NewId
|
||||
for _, f := range featuresInputs {
|
||||
ft, err := parseBytes(f.Name, f.Contents, dialect, newIDFunc)
|
||||
ft, err := parseBytes(f.Name, f.Contents, newIDFunc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -225,61 +217,19 @@ func ParseFromBytes(filter, dialect string, featuresInputs []FeatureContent) ([]
|
|||
features[idx] = feature
|
||||
}
|
||||
|
||||
features = FilterFeatures(filter, features)
|
||||
features = filterFeatures(filter, features)
|
||||
|
||||
return features, nil
|
||||
}
|
||||
|
||||
func FilterFeatures(filter string, features []*models.Feature) (result []*models.Feature) {
|
||||
focused := false
|
||||
|
||||
func filterFeatures(filter string, features []*models.Feature) (result []*models.Feature) {
|
||||
for _, ft := range features {
|
||||
ft.Pickles = tags.ApplyTagFilter(filter, ft.Pickles)
|
||||
|
||||
if containsFocusedPickle(ft.Pickles) {
|
||||
focused = true
|
||||
}
|
||||
|
||||
if ft.Feature != nil && len(ft.Pickles) > 0 {
|
||||
result = append(result, ft)
|
||||
}
|
||||
}
|
||||
|
||||
if !focused {
|
||||
return
|
||||
}
|
||||
|
||||
var resultF []*models.Feature
|
||||
for _, ft := range result {
|
||||
ft.Pickles = filterFocusedPickles(ft.Pickles)
|
||||
resultF = append(resultF, ft)
|
||||
}
|
||||
|
||||
return resultF
|
||||
}
|
||||
|
||||
func containsFocusedPickle(pickles []*messages.Pickle) bool {
|
||||
for _, p := range pickles {
|
||||
if containsFocusedTag(p.Tags) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
func containsFocusedTag(tags []*messages.PickleTag) bool {
|
||||
for _, t := range tags {
|
||||
if t.Name == "@f" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func filterFocusedPickles(pickles []*messages.Pickle) (result []*messages.Pickle) {
|
||||
for _, p := range pickles {
|
||||
if containsFocusedTag(p.Tags) {
|
||||
result = append(result, p)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package parser_test
|
|||
import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
|
@ -11,9 +10,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/parser"
|
||||
"git.golang1.ru/softonik/godog/internal/storage"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
"github.com/cucumber/godog/internal/parser"
|
||||
)
|
||||
|
||||
func Test_FeatureFilePathParser(t *testing.T) {
|
||||
|
@ -57,7 +54,7 @@ Feature: eat godogs
|
|||
{Name: "MyCoolDuplicatedFeature", Contents: []byte(eatGodogContents)},
|
||||
}
|
||||
|
||||
featureFromBytes, err := parser.ParseFromBytes("", "", input)
|
||||
featureFromBytes, err := parser.ParseFromBytes("", input)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, featureFromBytes, 1)
|
||||
}
|
||||
|
@ -83,7 +80,7 @@ Feature: eat godogs
|
|||
},
|
||||
}
|
||||
|
||||
featureFromFile, err := parser.ParseFeatures(fsys, "", "", []string{baseDir})
|
||||
featureFromFile, err := parser.ParseFeatures(fsys, "", []string{baseDir})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, featureFromFile, 1)
|
||||
|
||||
|
@ -91,7 +88,7 @@ Feature: eat godogs
|
|||
{Name: filepath.Join(baseDir, featureFileName), Contents: []byte(eatGodogContents)},
|
||||
}
|
||||
|
||||
featureFromBytes, err := parser.ParseFromBytes("", "", input)
|
||||
featureFromBytes, err := parser.ParseFromBytes("", input)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, featureFromBytes, 1)
|
||||
|
||||
|
@ -158,7 +155,7 @@ func Test_ParseFeatures_FromMultiplePaths(t *testing.T) {
|
|||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
features, err := parser.ParseFeatures(test.fsys, "", "", test.paths)
|
||||
features, err := parser.ParseFeatures(test.fsys, "", test.paths)
|
||||
if test.expError != nil {
|
||||
require.Error(t, err)
|
||||
require.EqualError(t, err, test.expError.Error())
|
||||
|
@ -181,183 +178,3 @@ func Test_ParseFeatures_FromMultiplePaths(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ParseFeatures_Localisation(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
dialect string
|
||||
contents string
|
||||
}{
|
||||
"english": {
|
||||
dialect: "en",
|
||||
contents: `
|
||||
Feature: dummy
|
||||
Rule: dummy
|
||||
Background: dummy
|
||||
Given dummy
|
||||
When dummy
|
||||
Then dummy
|
||||
Scenario: dummy
|
||||
Given dummy
|
||||
When dummy
|
||||
Then dummy
|
||||
And dummy
|
||||
But dummy
|
||||
Example: dummy
|
||||
Given dummy
|
||||
When dummy
|
||||
Then dummy
|
||||
Scenario Outline: dummy
|
||||
Given dummy
|
||||
When dummy
|
||||
Then dummy
|
||||
`,
|
||||
},
|
||||
"afrikaans": {
|
||||
dialect: "af",
|
||||
contents: `
|
||||
Funksie: dummy
|
||||
Regel: dummy
|
||||
Agtergrond: dummy
|
||||
Gegewe dummy
|
||||
Wanneer dummy
|
||||
Dan dummy
|
||||
Voorbeeld: dummy
|
||||
Gegewe dummy
|
||||
Wanneer dummy
|
||||
Dan dummy
|
||||
En dummy
|
||||
Maar dummy
|
||||
Voorbeelde: dummy
|
||||
Gegewe dummy
|
||||
Wanneer dummy
|
||||
Dan dummy
|
||||
Situasie Uiteensetting: dummy
|
||||
Gegewe dummy
|
||||
Wanneer dummy
|
||||
Dan dummy
|
||||
`,
|
||||
},
|
||||
"arabic": {
|
||||
dialect: "ar",
|
||||
contents: `
|
||||
خاصية: dummy
|
||||
Rule: dummy
|
||||
الخلفية: dummy
|
||||
بفرض dummy
|
||||
متى dummy
|
||||
اذاً dummy
|
||||
مثال: dummy
|
||||
بفرض dummy
|
||||
متى dummy
|
||||
اذاً dummy
|
||||
و dummy
|
||||
لكن dummy
|
||||
امثلة: dummy
|
||||
بفرض dummy
|
||||
متى dummy
|
||||
اذاً dummy
|
||||
سيناريو مخطط: dummy
|
||||
بفرض dummy
|
||||
متى dummy
|
||||
اذاً dummy
|
||||
`,
|
||||
},
|
||||
"chinese simplified": {
|
||||
dialect: "zh-CN",
|
||||
contents: `
|
||||
功能: dummy
|
||||
规则: dummy
|
||||
背景: dummy
|
||||
假如 dummy
|
||||
当 dummy
|
||||
那么 dummy
|
||||
场景: dummy
|
||||
假如 dummy
|
||||
当 dummy
|
||||
那么 dummy
|
||||
而且 dummy
|
||||
但是 dummy
|
||||
例子: dummy
|
||||
假如 dummy
|
||||
当 dummy
|
||||
那么 dummy
|
||||
场景大纲: dummy
|
||||
假如 dummy
|
||||
当 dummy
|
||||
那么 dummy
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
featureFileName := "godogs.feature"
|
||||
baseDir := "base"
|
||||
|
||||
for name, test := range tests {
|
||||
test := test
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fsys := fstest.MapFS{
|
||||
filepath.Join(baseDir, featureFileName): {
|
||||
Data: []byte(test.contents),
|
||||
Mode: fs.FileMode(0o644),
|
||||
},
|
||||
}
|
||||
|
||||
featureTestDialect, err := parser.ParseFeatures(fsys, "", test.dialect, []string{baseDir})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, featureTestDialect, 1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_FilterF_Features_FromMultipleFiles(t *testing.T) {
|
||||
const featureFileName = "godogs.feature"
|
||||
const featureFileContentsF = `Feature: focused
|
||||
|
||||
@f
|
||||
Scenario: Focused
|
||||
Given something
|
||||
When do
|
||||
Then ok`
|
||||
|
||||
const featureFileContentsNormal = `Feature: normal
|
||||
Scenario: normal
|
||||
Given something
|
||||
When do
|
||||
Then ok`
|
||||
|
||||
baseDir := filepath.Join(os.TempDir(), t.Name(), "godogs")
|
||||
errA := os.MkdirAll(baseDir+"/a", 0755)
|
||||
errB := os.MkdirAll(baseDir+"/b", 0755)
|
||||
defer os.RemoveAll(baseDir)
|
||||
|
||||
require.Nil(t, errA)
|
||||
require.Nil(t, errB)
|
||||
|
||||
err := os.WriteFile(filepath.Join(baseDir+"/a", featureFileName), []byte(featureFileContentsF), 0644)
|
||||
require.Nil(t, err)
|
||||
err = os.WriteFile(filepath.Join(baseDir+"/b", featureFileName), []byte(featureFileContentsNormal), 0644)
|
||||
require.Nil(t, err)
|
||||
|
||||
features, err := parser.ParseFeatures(storage.FS{}, "", "", []string{baseDir + "/a", baseDir + "/b"})
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, features, 2)
|
||||
|
||||
for _, f := range features {
|
||||
for _, p := range f.Pickles {
|
||||
if !containsFocusedTag(p.Tags) {
|
||||
assert.Failf(t, "found not Focused pickle", "Found not Focused pickle", p.Tags)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func containsFocusedTag(tags []*messages.PickleTag) bool {
|
||||
for _, t := range tags {
|
||||
if t.Name == "@f" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"testing"
|
||||
"testing/fstest"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/storage"
|
||||
"github.com/cucumber/godog/internal/storage"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
messages "github.com/cucumber/messages/go/v21"
|
||||
"github.com/hashicorp/go-memdb"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -223,7 +223,7 @@ func (s *Storage) MustGetPickleStepResult(id string) models.PickleStepResult {
|
|||
return v.(models.PickleStepResult)
|
||||
}
|
||||
|
||||
// MustGetPickleStepResultsByPickleID will retrieve pickle step results by pickle id and panic on error.
|
||||
// MustGetPickleStepResultsByPickleID will retrieve pickle strep results by pickle id and panic on error.
|
||||
func (s *Storage) MustGetPickleStepResultsByPickleID(pickleID string) (psrs []models.PickleStepResult) {
|
||||
it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexPickleID, pickleID)
|
||||
for v := it.Next(); v != nil; v = it.Next() {
|
||||
|
@ -233,21 +233,6 @@ func (s *Storage) MustGetPickleStepResultsByPickleID(pickleID string) (psrs []mo
|
|||
return psrs
|
||||
}
|
||||
|
||||
// MustGetPickleStepResultsByPickleIDUntilStep will retrieve pickle step results by pickle id
|
||||
// from 0..stepID for that pickle.
|
||||
func (s *Storage) MustGetPickleStepResultsByPickleIDUntilStep(pickleID string, untilStepID string) (psrs []models.PickleStepResult) {
|
||||
it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexPickleID, pickleID)
|
||||
for v := it.Next(); v != nil; v = it.Next() {
|
||||
psr := v.(models.PickleStepResult)
|
||||
psrs = append(psrs, psr)
|
||||
if psr.PickleStepID == untilStepID {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return psrs
|
||||
}
|
||||
|
||||
// MustGetPickleStepResultsByStatus will retrieve pickle strep results by status and panic on error.
|
||||
func (s *Storage) MustGetPickleStepResultsByStatus(status models.StepResultStatus) (psrs []models.PickleStepResult) {
|
||||
it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexStatus, status)
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
messages "github.com/cucumber/messages/go/v21"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"git.golang1.ru/softonik/godog/internal/storage"
|
||||
"git.golang1.ru/softonik/godog/internal/testutils"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/storage"
|
||||
"github.com/cucumber/godog/internal/testutils"
|
||||
)
|
||||
|
||||
func Test_MustGetPickle(t *testing.T) {
|
||||
|
@ -128,40 +128,6 @@ func Test_MustGetPickleStepResultsByPickleID(t *testing.T) {
|
|||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func Test_MustGetPickleStepResultsByPickleIDUntilStep(t *testing.T) {
|
||||
s := storage.NewStorage()
|
||||
|
||||
const pickleID = "p1"
|
||||
const stepID = "s2"
|
||||
|
||||
store := []models.PickleStepResult{
|
||||
{
|
||||
Status: models.Passed,
|
||||
PickleID: pickleID,
|
||||
PickleStepID: "s1",
|
||||
},
|
||||
{
|
||||
Status: models.Passed,
|
||||
PickleID: pickleID,
|
||||
PickleStepID: "s2",
|
||||
},
|
||||
{
|
||||
Status: models.Passed,
|
||||
PickleID: pickleID,
|
||||
PickleStepID: "s3",
|
||||
},
|
||||
}
|
||||
|
||||
for _, psr := range store {
|
||||
s.MustInsertPickleStepResult(psr)
|
||||
}
|
||||
|
||||
expected := store[:2]
|
||||
|
||||
actual := s.MustGetPickleStepResultsByPickleIDUntilStep(pickleID, stepID)
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func Test_MustGetPickleStepResultsByStatus(t *testing.T) {
|
||||
s := storage.NewStorage()
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@ import (
|
|||
// array of pickles and returned the filtered list.
|
||||
func ApplyTagFilter(filter string, pickles []*messages.Pickle) []*messages.Pickle {
|
||||
if filter == "" {
|
||||
ff := filterF(pickles)
|
||||
if len(ff) > 0 {
|
||||
return ff
|
||||
}
|
||||
|
||||
return pickles
|
||||
}
|
||||
|
||||
|
@ -65,15 +60,3 @@ func contains(tags []*messages.PickleTag, tag string) bool {
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
func filterF(pickles []*messages.Pickle) []*messages.Pickle {
|
||||
var result = []*messages.Pickle{}
|
||||
|
||||
for _, pickle := range pickles {
|
||||
if contains(pickle.Tags, "f") {
|
||||
result = append(result, pickle)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package tags_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/tags"
|
||||
)
|
||||
|
||||
type testcaseF struct {
|
||||
filter string
|
||||
input []*pickle
|
||||
expected []*pickle
|
||||
}
|
||||
|
||||
var testdataNonF = []*pickle{p1n, p2n, p3n}
|
||||
var testdataF = []*pickle{p1n, p2n, p3withF}
|
||||
var p1n = &pickle{Id: "one", Tags: []*tag{}}
|
||||
var p2n = &pickle{Id: "two", Tags: []*tag{{Name: "@wip"}}}
|
||||
var p3n = &pickle{Id: "three", Tags: []*tag{}}
|
||||
var p3withF = &pickle{Id: "three", Tags: []*tag{{Name: "@f"}}}
|
||||
|
||||
var testcasesF = []testcaseF{
|
||||
{filter: "", input: testdataNonF, expected: testdataNonF},
|
||||
{filter: "", input: testdataF, expected: []*pickle{p3withF}},
|
||||
{filter: "@wip", input: testdataF, expected: []*pickle{p2n}},
|
||||
}
|
||||
|
||||
func Test_ApplyTagFilterWithF(t *testing.T) {
|
||||
for _, tc := range testcasesF {
|
||||
t.Run("", func(t *testing.T) {
|
||||
actual := tags.ApplyTagFilter(tc.filter, tc.input)
|
||||
assert.Equal(t, tc.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/tags"
|
||||
"github.com/cucumber/godog/internal/tags"
|
||||
messages "github.com/cucumber/messages/go/v21"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
messages "github.com/cucumber/messages/go/v21"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"git.golang1.ru/softonik/godog/internal/models"
|
||||
"github.com/cucumber/godog/internal/models"
|
||||
)
|
||||
|
||||
// BuildTestFeature creates a feature for testing purpose.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package godog
|
||||
|
||||
import "git.golang1.ru/softonik/godog/internal/flags"
|
||||
import "github.com/cucumber/godog/internal/flags"
|
||||
|
||||
// Options are suite run options
|
||||
// flags are mapped to these options.
|
||||
|
|
|
@ -1,281 +0,0 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/format"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"errors"
|
||||
)
|
||||
|
||||
const (
|
||||
INIT_TEST_GO_FNAME = "init_test.go"
|
||||
)
|
||||
|
||||
type ASTer struct {
|
||||
pkg string
|
||||
pkg_test_go_fname string
|
||||
init_test_fset *token.FileSet
|
||||
init_test_node *ast.File
|
||||
pkg_test_fset *token.FileSet
|
||||
pkg_test_node *ast.File
|
||||
}
|
||||
|
||||
func NewASTer() (*ASTer, error) {
|
||||
a := &ASTer{}
|
||||
|
||||
pkg, err := получитьИмяGoПакетаВЭтойДире()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a.pkg = pkg
|
||||
|
||||
err = a.найтиТестовыйФайл()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func (a *ASTer) ДобавитьШаг(шаг, f, ps string) error {
|
||||
return a.добавитьШаг(шаг, f, ps)
|
||||
}
|
||||
|
||||
func (a *ASTer) найтиТестовыйФайл() error {
|
||||
a.сгенеритьИмяФайла()
|
||||
_, err := os.Stat(INIT_TEST_GO_FNAME)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = os.Stat(a.pkg_test_go_fname)
|
||||
return err
|
||||
}
|
||||
func (a *ASTer) сгенеритьИмяФайла() {
|
||||
a.pkg_test_go_fname = a.pkg + "_test.go"
|
||||
}
|
||||
|
||||
func (a *ASTer) добавитьШаг(шаг, f, ps string) error {
|
||||
err := a.добавитьШагвInitФайл(шаг, f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = a.добавитьФункциювТестовыйФайл(f, ps)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
func (a *ASTer) добавитьШагвInitФайл(шаг, f string) error {
|
||||
err := a.спарситьInitФайлиДобавитьШаг(шаг, f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = a.перезаписатьInitФайл()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (a *ASTer) добавитьФункциювТестовыйФайл(f, ps string) error {
|
||||
err := a.спарситьФайлиДобавитьФункцию(f, ps)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = a.перезаписатьФайл()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *ASTer) спарситьInitФайлиДобавитьШаг(шаг, func_name string) error {
|
||||
err := a.спарситьInitФайл()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f := a.создатьШаг(шаг, func_name)
|
||||
a.добавитьШагвИнициализаторЕслиНету(f)
|
||||
return nil
|
||||
}
|
||||
func (a *ASTer) спарситьФайлиДобавитьФункцию(func_name, ps string) error {
|
||||
err := a.спарситьФайл()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f := a.создатьФункцию(func_name, ps)
|
||||
a.добавитьФункцию(f)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *ASTer) добавитьШагвИнициализаторЕслиНету(step *ast.ExprStmt) {
|
||||
for _, d := range a.init_test_node.Decls {
|
||||
f, ok := d.(*ast.FuncDecl)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if f.Name == nil {
|
||||
continue
|
||||
}
|
||||
if f.Name.Name == "InitializeScenario" {
|
||||
a.добавитьШагвФункциюInitializeScenario(f, step)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
func (a *ASTer) добавитьШагвФункциюInitializeScenario(f *ast.FuncDecl, step *ast.ExprStmt) {
|
||||
for i, stmt := range f.Body.List {
|
||||
if являетсяЛиШагомсТакойЖеФункцией(stmt, step) {
|
||||
return
|
||||
}
|
||||
|
||||
if !являетсяЛиШагом(stmt) {
|
||||
n := append([]ast.Stmt{step}, f.Body.List[i:]...)
|
||||
f.Body.List = append(f.Body.List[0:i], n...)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
func (a *ASTer) добавитьФункцию(fun *ast.FuncDecl) {
|
||||
for _, d := range a.pkg_test_node.Decls {
|
||||
f, ok := d.(*ast.FuncDecl)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if f.Name == nil {
|
||||
continue
|
||||
}
|
||||
if f.Name.Name == fun.Name.Name {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
a.pkg_test_node.Decls = append(a.pkg_test_node.Decls, fun)
|
||||
}
|
||||
|
||||
func (a *ASTer) спарситьInitФайл() error {
|
||||
fset := token.NewFileSet()
|
||||
node, err := parser.ParseFile(fset, INIT_TEST_GO_FNAME, nil, parser.AllErrors|parser.ParseComments)
|
||||
a.init_test_fset = fset
|
||||
a.init_test_node = node
|
||||
return err
|
||||
}
|
||||
func (a *ASTer) спарситьФайл() error {
|
||||
fset := token.NewFileSet()
|
||||
node, err := parser.ParseFile(fset, a.pkg_test_go_fname, nil, parser.AllErrors|parser.ParseComments)
|
||||
a.pkg_test_fset = fset
|
||||
a.pkg_test_node = node
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *ASTer) создатьШаг(шаг, func_name string) *ast.ExprStmt {
|
||||
st := &ast.ExprStmt{
|
||||
X: &ast.CallExpr{
|
||||
Fun: &ast.SelectorExpr{
|
||||
X: ast.NewIdent("ctx"),
|
||||
Sel: ast.NewIdent("Step"),
|
||||
},
|
||||
Args: []ast.Expr{
|
||||
&ast.BasicLit{
|
||||
Kind: token.STRING,
|
||||
Value: шаг,
|
||||
},
|
||||
ast.NewIdent(func_name),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return st
|
||||
}
|
||||
func (a *ASTer) создатьФункцию(func_name, ps string) *ast.FuncDecl {
|
||||
f := &ast.FuncDecl{
|
||||
Name: ast.NewIdent(func_name),
|
||||
Type: &ast.FuncType{
|
||||
Params: &ast.FieldList{},
|
||||
},
|
||||
Body: &ast.BlockStmt{},
|
||||
}
|
||||
|
||||
a.добавитьПараметрыФункции(f, ps)
|
||||
|
||||
return f
|
||||
}
|
||||
func (a *ASTer) добавитьПараметрыФункции(f *ast.FuncDecl, ps string) {
|
||||
params := a.сконвертитьСтрокувПараметры(ps)
|
||||
|
||||
var names []*ast.Ident
|
||||
|
||||
for _, p := range params {
|
||||
switch len(p) {
|
||||
case 0:
|
||||
continue
|
||||
case 1:
|
||||
names = append(names, ast.NewIdent(p[0]))
|
||||
case 2:
|
||||
names = append(names, ast.NewIdent(p[0]))
|
||||
field := &ast.Field{
|
||||
Names: names,
|
||||
Type: ast.NewIdent(p[1]),
|
||||
}
|
||||
f.Type.Params.List = append(f.Type.Params.List, field)
|
||||
names = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
func (a *ASTer) сконвертитьСтрокувПараметры(in string) (ret Параметры) {
|
||||
params := strings.Split(in, ",")
|
||||
|
||||
for _, p := range params {
|
||||
ps := strings.Fields(p)
|
||||
параметр := Параметр{}
|
||||
|
||||
switch len(ps) {
|
||||
case 0:
|
||||
continue
|
||||
case 1:
|
||||
параметр = append(параметр, ps[0])
|
||||
case 2:
|
||||
параметр = append(параметр, ps[0], ps[1])
|
||||
}
|
||||
ret = append(ret, параметр)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ASTer) перезаписатьInitФайл() error {
|
||||
err := переименоватьФайлСоВременем(INIT_TEST_GO_FNAME)
|
||||
if err != nil {
|
||||
return errors.Join(err, errors.New("cant backup orig file"))
|
||||
}
|
||||
|
||||
f, err := os.Create(INIT_TEST_GO_FNAME)
|
||||
if err != nil {
|
||||
return errors.Join(err, errors.New("cant rewrite orig file"))
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return format.Node(f, a.init_test_fset, a.init_test_node)
|
||||
}
|
||||
func (a *ASTer) перезаписатьФайл() error {
|
||||
err := переименоватьФайлСоВременем(a.pkg_test_go_fname)
|
||||
if err != nil {
|
||||
return errors.Join(err, errors.New("cant backup orig file"))
|
||||
}
|
||||
|
||||
f, err := os.Create(a.pkg_test_go_fname)
|
||||
if err != nil {
|
||||
return errors.Join(err, errors.New("cant rewrite orig file"))
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return format.Node(f, a.pkg_test_fset, a.pkg_test_node)
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/pkg/formatters/ast"
|
||||
"git.golang1.ru/softonik/godog/pkg/lib"
|
||||
. "git.golang1.ru/softonik/godog_and_gomega"
|
||||
. "github.com/onsi/gomega"
|
||||
. "github.com/onsi/gomega/format"
|
||||
)
|
||||
|
||||
type testData struct {
|
||||
tempdir string
|
||||
}
|
||||
|
||||
var (
|
||||
t *testData
|
||||
)
|
||||
|
||||
func resetTestData() {
|
||||
t = &testData{}
|
||||
}
|
||||
func beforeSuite() {
|
||||
CharactersAroundMismatchToInclude = 100
|
||||
}
|
||||
func afterSuite() {
|
||||
}
|
||||
|
||||
func beforeScenario() {
|
||||
resetTestData()
|
||||
createTempDir()
|
||||
}
|
||||
func afterScenario() {
|
||||
rmTempDir()
|
||||
}
|
||||
|
||||
func createTempDir() {
|
||||
dir := filepath.Clean(os.TempDir())
|
||||
tempDir, err := os.MkdirTemp(dir, "test-")
|
||||
Ok(err)
|
||||
t.tempdir = tempDir
|
||||
err = os.Chdir(t.tempdir)
|
||||
Ok(err)
|
||||
}
|
||||
|
||||
func rmTempDir() {
|
||||
err := os.RemoveAll(t.tempdir)
|
||||
Ok(err)
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
|
||||
func файл(fname string, content *godog.DocString) {
|
||||
err := lib.WriteFile(fname, content.Content)
|
||||
Ok(err)
|
||||
}
|
||||
|
||||
func добавляетсяШагСФункциейС(шаг, func_name, params string) {
|
||||
err := ast.ДобавитьШаг("`"+шаг+"`", func_name, params)
|
||||
Ok(err)
|
||||
}
|
||||
|
||||
func файлДолженСодержать(fname string, content *godog.DocString) {
|
||||
cont, err := lib.ReadFile(fname)
|
||||
Ok(err)
|
||||
|
||||
Ω(cont).To(Be(content.Content))
|
||||
|
||||
pkg, err := lib.ПолучитьИмяGoПакетаФайла(fname)
|
||||
Ok(err)
|
||||
Ω(pkg).To(Be("mypkg"))
|
||||
}
|
|
@ -1,429 +0,0 @@
|
|||
# language: ru
|
||||
Функционал: AST-редактир go-файлов
|
||||
Сгенерированные функции автоматически добавляются в тест-файл текущего пакета
|
||||
|
||||
Сценарий: Добавление шага
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с ""
|
||||
То Файл "init_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^Привет Мир!$`, ПриветМир)
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир() {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага с параметрами: int
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int"
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(arg1 int) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага с параметрами: int, string
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int, arg2 string"
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(arg1 int, arg2 string) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага с параметрами: string, int
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 string, arg2 int"
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(arg1 string, arg2 int) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага к существующему
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`сделать чтото`, СделатьЧтото)
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func СделатьЧтото(arg1 string, arg2 int) {
|
||||
a := 1
|
||||
}
|
||||
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int"
|
||||
То Файл "init_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`сделать чтото`, СделатьЧтото)
|
||||
ctx.Step(`^Привет Мир!$`, ПриветМир)
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func СделатьЧтото(arg1 string, arg2 int) {
|
||||
a := 1
|
||||
}
|
||||
func ПриветМир(arg1 int) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Не добавляет если шаг с такой функцией уже есть
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^Привет Мир!$`, ПриветМир)
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(arg1 string, arg2 int) {
|
||||
a := 1
|
||||
}
|
||||
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int"
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int"
|
||||
То Файл "init_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^Привет Мир!$`, ПриветМир)
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(arg1 string, arg2 int) {
|
||||
a := 1
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Второй раз - не добавляет
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int"
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "arg1 int"
|
||||
То Файл "init_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^Привет Мир!$`, ПриветМир)
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(arg1 int) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага с параметрами строкой
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "a int, s string, content *godog.DocString"
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(a int, s string, content *godog.DocString) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага с параметрами строкой с объединением по типу
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "a, b, c int"
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(a, b, c int) {
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Сценарий: Добавление шага с параметрами строкой с объединением по типам
|
||||
Дано Файл "init_test.go":
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
```
|
||||
Дано Файл "mypkg_test.go":
|
||||
```
|
||||
package mypkg
|
||||
```
|
||||
Когда Добавляется шаг: "^Привет Мир!$" с функцией "ПриветМир" с "a, b int, s1, s2 string"
|
||||
То Файл "mypkg_test.go" должен содержать:
|
||||
```
|
||||
package mypkg
|
||||
|
||||
func ПриветМир(a, b int, s1, s2 string) {
|
||||
}
|
||||
|
||||
```
|
|
@ -1,48 +0,0 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.golang1.ru/softonik/godog"
|
||||
"git.golang1.ru/softonik/godog/colors"
|
||||
. "git.golang1.ru/softonik/godog_and_gomega"
|
||||
)
|
||||
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^Файл "([^"]*)":$`, файл)
|
||||
ctx.Step(`^Добавляется шаг: "([^"]*)" с функцией "([^"]*)" с "([^"]*)"$`, добавляетсяШагСФункциейС)
|
||||
ctx.Step(`^Файл "([^"]*)" должен содержать:$`, файлДолженСодержать)
|
||||
|
||||
// -----------------------
|
||||
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
||||
beforeScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
||||
afterScenario()
|
||||
return ctx, nil
|
||||
})
|
||||
InitializeGomegaForGodog(ctx)
|
||||
}
|
||||
|
||||
func InitializeSuite(tsc *godog.TestSuiteContext) {
|
||||
tsc.BeforeSuite(beforeSuite)
|
||||
tsc.AfterSuite(afterSuite)
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
var opts = godog.Options{
|
||||
Output: colors.Colored(os.Stdout),
|
||||
Strict: true,
|
||||
StopOnFailure: true,
|
||||
}
|
||||
r := godog.TestSuite{
|
||||
Name: "app",
|
||||
TestSuiteInitializer: InitializeSuite,
|
||||
ScenarioInitializer: InitializeScenario,
|
||||
Options: &opts,
|
||||
}.Run()
|
||||
os.Exit(r)
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package ast
|
||||
|
||||
// 0: имя, 1: тип
|
||||
type Параметр []string
|
||||
type Параметры []Параметр
|
||||
|
||||
func ДобавитьШаг(шаг, f string, ps string) error {
|
||||
a, err := NewASTer()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return a.ДобавитьШаг(шаг, f, ps)
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"errors"
|
||||
|
||||
"git.golang1.ru/softonik/godog/pkg/lib"
|
||||
)
|
||||
|
||||
const (
|
||||
BACKUP_DIR = ".back"
|
||||
)
|
||||
|
||||
func получитьИмяGoПакетаВЭтойДире() (pkg_name string, err_ret error) {
|
||||
err_ret = errors.New("not found")
|
||||
|
||||
filepath.WalkDir(".", func(path string, info os.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !info.IsDir() &&
|
||||
filepath.Ext(path) == ".go" &&
|
||||
info.Name() != "Magefile.go" {
|
||||
pkg, err := lib.ПолучитьИмяGoПакетаФайла(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pkg_name = pkg
|
||||
err_ret = nil
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func переименоватьФайлСоВременем(fname string) error {
|
||||
os.MkdirAll(BACKUP_DIR, 0755)
|
||||
currentTime := time.Now()
|
||||
timestamp := currentTime.Format("20060102_150405")
|
||||
new_fname := fmt.Sprintf(BACKUP_DIR+"/%v_%v", fname, timestamp)
|
||||
return os.Rename(fname, new_fname)
|
||||
}
|
||||
|
||||
func являетсяЛиШагомсТакойЖеФункцией(stmt ast.Stmt, step *ast.ExprStmt) bool {
|
||||
e, ok := stmt.(*ast.ExprStmt)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
e_name, err := имяШага(e)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
step_name, err := имяШага(step)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return e_name == step_name
|
||||
}
|
||||
func являетсяЛиШагом(stmt ast.Stmt) bool {
|
||||
e, ok := stmt.(*ast.ExprStmt)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
e_name, err := имяШага(e)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return len(e_name) > 0
|
||||
}
|
||||
|
||||
func имяШага(step *ast.ExprStmt) (res string, err error) {
|
||||
err = errors.New("not found")
|
||||
|
||||
call, ok := step.X.(*ast.CallExpr)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
selector, ok := call.Fun.(*ast.SelectorExpr)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
ctx, ok := selector.X.(*ast.Ident)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Name != "ctx" {
|
||||
return
|
||||
}
|
||||
|
||||
if selector.Sel.Name != "Step" {
|
||||
return
|
||||
}
|
||||
|
||||
if len(call.Args) < 2 {
|
||||
return
|
||||
}
|
||||
|
||||
fn, ok := call.Args[1].(*ast.Ident)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
return fn.Name, nil
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
"go/parser"
|
||||
"go/token"
|
||||
)
|
||||
|
||||
func ПолучитьИмяGoПакетаФайла(fname string) (string, error) {
|
||||
fset := token.NewFileSet()
|
||||
node, err := parser.ParseFile(fset, fname, nil, parser.AllErrors)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return node.Name.Name, nil
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ReadFile(path string) (string, error) {
|
||||
ret, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(ret), nil
|
||||
}
|
||||
func WriteFile(path, data string) error {
|
||||
return os.WriteFile(path, []byte(data), 0644)
|
||||
}
|
||||
|
||||
func CopyFile(src, dst string) (err error) {
|
||||
in, err := os.Open(src)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
defer in.Close()
|
||||
|
||||
out, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
cerr := out.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
|
||||
if _, err = io.Copy(out, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = out.Sync()
|
||||
|
||||
return
|
||||
}
|
Показаны не все изменённые файлы, т.к. их слишком много Показать больше
Загрузка…
Создание таблицы
Сослаться в новой задаче