Сравнить коммиты

..

20 коммитов
v1.2.0 ... main

Автор SHA1 Сообщение Дата
Softonik
6087fc101c AST: файл Magefile.go пропускается при поиске имени пакета
Некоторые проверки провалились
test / test (1.16.x) (push) Has been cancelled
test / test (1.17.x) (push) Has been cancelled
test / test (oldstable) (push) Has been cancelled
test / test (stable) (push) Has been cancelled
2025-06-06 17:06:26 +03:00
Softonik
f5ec4cadce +Magefile.go
Ожидается выполнение проверок
test / test (1.16.x) (push) Waiting to run
test / test (1.17.x) (push) Waiting to run
test / test (oldstable) (push) Waiting to run
test / test (stable) (push) Waiting to run
2025-06-06 16:12:53 +03:00
Softonik
ccc4a42649 AST: из Base скопирован/поправлен генератор функций:
с прямой последовательностью и добавлением шагов в тестовые файлы
2025-06-06 16:10:49 +03:00
Softonik
59344caf33 AST: тесты вынесены во вложенный пакет, чтобы не было циклической зависимости 2025-06-06 15:52:32 +03:00
Softonik
56522e757a + Сценарий: Добавление шага с параметрами строкой 2025-06-06 15:15:44 +03:00
Softonik
bda4071975 ++ Сценарии: Добавление шага 2025-06-05 06:44:44 +03:00
Softonik
af6027bad2 + Сценарий: Добавление функции к существующей + без дубликаций 2025-06-05 03:50:32 +03:00
Softonik
9ad168ae70 + Сценарий: Добавление функции с параметрами: int, string 2025-06-05 03:29:34 +03:00
Softonik
4a15650887 + Сценарий: Добавление функции с параметрами: int 2025-06-05 03:02:37 +03:00
Softonik
6f2a5fef98 + Сценарий: Добавление сгенерированных функций в test-файл 2025-06-05 02:08:33 +03:00
Softonik
4e3e82b79e Добавлено godog_and_gomega + сопутствующие обновления модулей и кода 2025-06-04 23:20:51 +03:00
Softonik
26dafa0117 +Для русских сценариев генерируются русские функции 2025-06-04 22:53:47 +03:00
Softonik
3b25e9eb02 Сокращён вывод результатов 2025-06-04 22:29:13 +03:00
Softonik
78bab577c5 Добавлен формат AST 2025-06-03 05:03:20 +03:00
Softonik
0c030e0a6c Модуль переименован для публикации 2025-06-03 04:16:23 +03:00
Softonik
1b9806b25b чистка 2025-06-03 03:30:46 +03:00
Softonik
d2686eb13d чистка 2025-06-03 03:12:20 +03:00
Softonik
f0399fda41 Добавлена поддержка focused-тестов во множестве feature-файлов 2025-06-03 03:11:14 +03:00
Softonik
13639e7df7 Добавлена поддержка тестов с f-тегом 2025-06-03 03:06:08 +03:00
Softonik
60442133fc Тесты: отключены хрупкие тесты, проверяющие общее их количество 2025-06-03 02:58:55 +03:00
48 изменённых файлов: 2004 добавлений и 349 удалений

Просмотреть файл

@ -9,7 +9,7 @@ import (
) )
var ( var (
GolangVolume = "/gopath/go/1.17" GolangVolume = "golang.upstream"
) )
func init() { func init() {
@ -19,7 +19,28 @@ func init() {
func Test() { func Test() {
TestNative() TestNative()
TestMakefile() }
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() { func TestMakefile() {
@ -45,29 +66,6 @@ func TestMakefile() {
'`) '`)
} }
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 \
'`)
}
func TestSnippets() { func TestSnippets() {
Bash(`sudo docker run -ti --rm \ Bash(`sudo docker run -ti --rm \
-h host \ -h host \

Просмотреть файл

@ -23,8 +23,8 @@ check-go-version:
test: check-go-version test: check-go-version
@echo "running all tests" @echo "running all tests"
@go fmt ./... @go fmt ./...
@go run honnef.co/go/tools/cmd/staticcheck@v0.5.1 github.com/cucumber/godog @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 github.com/cucumber/godog/cmd/godog @go run honnef.co/go/tools/cmd/staticcheck@v0.5.1 git.golang1.ru/softonik/godog/cmd/godog
go vet ./... go vet ./...
go test -race ./... go test -race ./...
go run ./cmd/godog -f progress -c 4 go run ./cmd/godog -f progress -c 4
@ -69,7 +69,7 @@ artifacts:
define _build define _build
mkdir $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2 mkdir $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2
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 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
cp README.md $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/README.md cp README.md $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/README.md
cp LICENSE $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/LICENSE 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 .. cd $(ARTIFACT_DIR) && tar -c --use-compress-program="pigz --fast" -f godog-$(VERS)-$1-$2.tar.gz godog-$(VERS)-$1-$2 && cd ..

Просмотреть файл

@ -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 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. steps are yet undefined and provide us with the snippets to implement them.
![Screenshot](https://raw.github.com/cucumber/godog/master/_examples/api/screenshots/undefined.png) ![Screenshot](https://raw.git.golang1.ru/softonik/godog/master/_examples/api/screenshots/undefined.png)
### Step 3 ### Step 3
@ -56,7 +56,7 @@ need to store state within steps (a response), we should introduce a structure w
package main package main
import ( import (
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
type apiFeature struct { type apiFeature struct {
@ -114,7 +114,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
type apiFeature struct { type apiFeature struct {
@ -228,7 +228,7 @@ import (
"encoding/json" "encoding/json"
"net/http" "net/http"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func getVersion(w http.ResponseWriter, r *http.Request) { 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` Run our tests to see whether everything is happening as we have expected: `go test -v`
![Screenshot](https://raw.github.com/cucumber/godog/master/_examples/api/screenshots/passed.png) ![Screenshot](https://raw.git.golang1.ru/softonik/godog/master/_examples/api/screenshots/passed.png)
### Conclusions ### Conclusions

Просмотреть файл

@ -1,7 +1,7 @@
# An example of API with DB # An example of API with DB
The following example demonstrates steps how we describe and test our API with DB using **godog**. The following example demonstrates steps how we describe and test our API with DB using **godog**.
To start with, see [API example](https://github.com/cucumber/godog/tree/master/_examples/api) before. To start with, see [API example](https://git.golang1.ru/softonik/godog/tree/master/_examples/api) before.
We have extended it to be used with database. 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, The interesting point is, that we have [go-txdb](https://github.com/DATA-DOG/go-txdb) library,

Просмотреть файл

@ -1,4 +1,4 @@
This example is to help reproduce issue [#383](https://github.com/cucumber/godog/issues/383) This example is to help reproduce issue [#383](https://git.golang1.ru/softonik/godog/issues/383)
To run the example: To run the example:

Просмотреть файл

@ -295,10 +295,12 @@ Feature: pretty formatter
You can implement step definitions for undefined steps with these snippets: You can implement step definitions for undefined steps with these snippets:
func undefinedDocString(arg1 *godog.DocString) { func undefinedDocString(arg1 *godog.DocString) error {
return godog.ErrPending
} }
func undefinedTable(arg1 *godog.Table) { func undefinedTable(arg1 *godog.Table) error {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

Просмотреть файл

@ -20,17 +20,18 @@ Feature: undefined step snippets
""" """
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func InitializeScenario(ctx *godog.ScenarioContext) {} func iSendRequestTo(arg1, arg2 string) error {
// --- return godog.ErrPending
func iSendRequestTo(arg1, arg2 string) {
}
func theResponseCodeShouldBe(arg1 int) {
} }
ctx.Step(`^I send "([^"]*)" request to "([^"]*)"$`, iSendRequestTo) func theResponseCodeShouldBe(arg1 int) error {
ctx.Step(`^the response code should be (\d+)$`, theResponseCodeShouldBe) return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^I send "([^"]*)" request to "([^"]*)"$`, iSendRequestTo)
ctx.Step(`^the response code should be (\d+)$`, theResponseCodeShouldBe)
}
""" """
Scenario: should generate snippets with more arguments Scenario: should generate snippets with more arguments
@ -51,20 +52,23 @@ Feature: undefined step snippets
When I run feature suite When I run feature suite
Then the undefined step snippets should be: Then the undefined step snippets should be:
""" """
func InitializeScenario(ctx *godog.ScenarioContext) {} func iSendRequestToWith(arg1, arg2 string, arg3 *godog.Table) error {
// --- return godog.ErrPending
func iSendRequestToWith(arg1, arg2 string, arg3 *godog.Table) {
}
func theResponseCodeShouldBeAndHeaderShouldBe(arg1 int, arg2, arg3 string) {
}
func theResponseBodyShouldBe(arg1 *godog.DocString) {
} }
ctx.Step(`^I send "([^"]*)" request to "([^"]*)" with:$`, iSendRequestToWith) func theResponseBodyShouldBe(arg1 *godog.DocString) error {
ctx.Step(`^the response code should be (\d+) and header "([^"]*)" should be "([^"]*)"$`, theResponseCodeShouldBeAndHeaderShouldBe) return godog.ErrPending
ctx.Step(`^the response body should be:$`, theResponseBodyShouldBe) }
func theResponseCodeShouldBeAndHeaderShouldBe(arg1 int, arg2, arg3 string) error {
return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^I send "([^"]*)" request to "([^"]*)" with:$`, iSendRequestToWith)
ctx.Step(`^the response body should be:$`, theResponseBodyShouldBe)
ctx.Step(`^the response code should be (\d+) and header "([^"]*)" should be "([^"]*)"$`, theResponseCodeShouldBeAndHeaderShouldBe)
}
""" """
Scenario: should handle escaped symbols Scenario: should handle escaped symbols
@ -84,17 +88,18 @@ Feature: undefined step snippets
""" """
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func InitializeScenario(ctx *godog.ScenarioContext) {} func iPullFromGithubcom() error {
// --- return godog.ErrPending
func iPullFromGithubcom() {
}
func theProjectShouldBeThere() {
} }
ctx.Step(`^I pull from github\.com$`, iPullFromGithubcom) func theProjectShouldBeThere() error {
ctx.Step(`^the project should be there$`, theProjectShouldBeThere) return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^I pull from github\.com$`, iPullFromGithubcom)
ctx.Step(`^the project should be there$`, theProjectShouldBeThere)
}
""" """
Scenario: should handle string argument followed by comma Scenario: should handle string argument followed by comma
@ -109,17 +114,18 @@ Feature: undefined step snippets
When I run feature suite When I run feature suite
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func InitializeScenario(ctx *godog.ScenarioContext) {} func iAddTheToTheBasket(arg1 string) error {
// --- return godog.ErrPending
func thereIsAWhichCosts(arg1 string, arg2 int) {
}
func iAddTheToTheBasket(arg1 string) {
} }
ctx.Step(`^there is a "([^"]*)", which costs £(\d+)$`, thereIsAWhichCosts) func thereIsAWhichCosts(arg1 string, arg2 int) error {
ctx.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket) return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket)
ctx.Step(`^there is a "([^"]*)", which costs £(\d+)$`, thereIsAWhichCosts)
}
""" """
Scenario: should handle arguments in the beggining or end of the step Scenario: should handle arguments in the beggining or end of the step
@ -134,21 +140,21 @@ Feature: undefined step snippets
When I run feature suite When I run feature suite
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func InitializeScenario(ctx *godog.ScenarioContext) {} func godogs(arg1 int) error {
// --- return godog.ErrPending
func whichCosts(arg1 string, arg2 int) {
}
func godogs(arg1 int) {
} }
ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts) func whichCosts(arg1 string, arg2 int) error {
ctx.Step(`^(\d+) godogs$`, godogs) return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^(\d+) godogs$`, godogs)
ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts)
}
""" """
Scenario: should generate snippets in russian Scenario: Для русских сценариев генерируются русские функции
and gen'ed functions are in declaration order
Given a feature "undefined.feature" file: Given a feature "undefined.feature" file:
""" """
# language: ru # language: ru
@ -157,32 +163,33 @@ Feature: undefined step snippets
Сценарий: делает что-то полезное Сценарий: делает что-то полезное
Дано что-то Дано что-то
Когда я делаю ещё что-то "<param1>", 1, 2, param="<param2>", "<параметр3>", "just string", "<data>" Когда я делаю ещё что-то
То получается ещё более что-то То получается ещё более что-то
Примеры:
|param1|param2|параметр3|data|
|--- |--- |--- |--- |
""" """
When I run feature suite When I run feature suite
Then the following steps should be undefined: Then the following steps should be undefined:
""" """
получается ещё более что-то получается ещё более что-то
что-то что-то
я делаю ещё что-то
""" """
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func InitializeScenario(ctx *godog.ScenarioContext) {} func получаетсяЕщёБолееЧтото() error {
// --- return godog.ErrPending
func чтото() {
}
func яДелаюЕщёЧтотоParam(param1 string, arg1, arg2 int, param2, параметр3, arg3, data string) {
}
func получаетсяЕщёБолееЧтото() {
} }
ctx.Step(`^что-то$`, чтото) func чтото() error {
ctx.Step(`^я делаю ещё что-то "([^"]*)", (\d+), (\d+), param="([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$`, яДелаюЕщёЧтотоParam) return godog.ErrPending
ctx.Step(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото) }
func яДелаюЕщёЧтото() error {
return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото)
ctx.Step(`^что-то$`, чтото)
ctx.Step(`^я делаю ещё что-то$`, яДелаюЕщёЧтото)
}
""" """

Просмотреть файл

@ -208,7 +208,7 @@ func usage(set *flag.FlagSet, w io.Writer) func() {
// --- GENERAL --- // --- GENERAL ---
fmt.Fprintln(w, colors.Yellow("Usage:")) fmt.Fprintln(w, colors.Yellow("Usage:"))
fmt.Fprintf(w, s(2)+"go test [options]\n\n") fmt.Fprint(w, s(2)+"go test [options]\n\n")
// --- OPTIONS --- // --- OPTIONS ---
fmt.Fprintln(w, colors.Yellow("Options:")) fmt.Fprintln(w, colors.Yellow("Options:"))

20
go.mod
Просмотреть файл

@ -1,13 +1,27 @@
module git.golang1.ru/softonik/godog module git.golang1.ru/softonik/godog
go 1.16 go 1.24.2
require ( require (
git.golang1.ru/softonik/godog_and_gomega v1.0.0
github.com/cucumber/gherkin/go/v26 v26.2.0 github.com/cucumber/gherkin/go/v26 v26.2.0
github.com/hashicorp/go-memdb v1.3.4 github.com/hashicorp/go-memdb v1.3.5
github.com/onsi/gomega v1.37.0
github.com/spf13/cobra v1.7.0 github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.6 github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.8.2 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
) )
require ( require (

49
go.sum
Просмотреть файл

@ -1,26 +1,33 @@
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/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 h1:EgIjePLWiPeslwIWmNQ3XHcypPsWAHoMCz/YEBKP4GI=
github.com/cucumber/gherkin/go/v26 v26.2.0/go.mod h1:t2GAPnB8maCT4lkHL99BDCVNzCh1d7dBhCLt150Nr/0= 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 h1:wzA0LxwjlWQYZd32VTlAVDTkW6inOFmSM+RuOwHZiMI=
github.com/cucumber/messages/go/v21 v21.0.1/go.mod h1:zheH/2HS9JLVFukdrsPWoPdmUtmYQAQPLk7w5vWsk5s= 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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= 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/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= 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-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-memdb v1.3.4 h1:XSL3NR682X/cVk2IeV0d70N4DZ9ljI885xAEU8IoK3c= github.com/hashicorp/go-memdb v1.3.5 h1:b3taDMxCBCBVgyRrS1AZVHO14ubMYZB++QpNhBg+Nyo=
github.com/hashicorp/go-memdb v1.3.4/go.mod h1:uBTr1oQbtuMgd1SSGoR8YV27eT3sBHbYiNm53bMpgSg= github.com/hashicorp/go-memdb v1.3.5/go.mod h1:8IVKKBkVe+fxFgdFOYxzQQNjz+sWCyHCdIC/+5+Vy1Y=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 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 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 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.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 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 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
@ -28,26 +35,30 @@ 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/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 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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/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 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= 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.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 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/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 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=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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 h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 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 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

680
internal/formatters/fmt_ast.go Обычный файл
Просмотреть файл

@ -0,0 +1,680 @@
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)
}

Просмотреть файл

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"sort"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -173,7 +174,7 @@ func (f *Base) Summary() {
if totalSc == 0 { if totalSc == 0 {
fmt.Fprintln(f.out, "No scenarios") fmt.Fprintln(f.out, "No scenarios")
} else { } else {
fmt.Fprintf(f.out, "%d scenarios (%s), ", totalSc, strings.Join(scenarios, ", ")) fmt.Fprintf(f.out, "%d scenarios (%s)\n", totalSc, strings.Join(scenarios, ", "))
} }
if totalSt == 0 { if totalSt == 0 {
@ -215,6 +216,7 @@ func (f *Base) Snippets() string {
// build snippets // build snippets
for _, u := range undefinedStepResults { for _, u := range undefinedStepResults {
pickleStep := f.Storage.MustGetPickleStep(u.PickleStepID) pickleStep := f.Storage.MustGetPickleStep(u.PickleStepID)
steps := []string{pickleStep.Text} steps := []string{pickleStep.Text}
arg := pickleStep.Argument arg := pickleStep.Argument
if u.Def != nil { if u.Def != nil {
@ -237,7 +239,6 @@ func (f *Base) Snippets() string {
w = strings.Title(w) w = strings.Title(w)
case len(w) > 0: case len(w) > 0:
r := []rune(w) r := []rune(w)
// tut
w = string(unicode.ToLower(r[0])) + string(r[1:]) w = string(unicode.ToLower(r[0])) + string(r[1:])
} }
words = append(words, w) words = append(words, w)
@ -256,16 +257,13 @@ func (f *Base) Snippets() string {
} }
} }
if !found { if !found {
snips = append(snips, undefinedSnippet{ snips = append(snips, undefinedSnippet{Method: name, Expr: expr, argument: arg})
Method: name,
Expr: expr,
argument: arg,
argument_names: f.get_argument_names(&u, pickleStep),
})
} }
} }
} }
sort.Sort(snippetSortByMethod(snips))
var buf bytes.Buffer var buf bytes.Buffer
if err := undefinedSnippetsTpl.Execute(&buf, snips); err != nil { if err := undefinedSnippetsTpl.Execute(&buf, snips); err != nil {
panic(err) panic(err)
@ -273,58 +271,3 @@ func (f *Base) Snippets() string {
// there may be trailing spaces // there may be trailing spaces
return strings.Replace(buf.String(), " \n", "\n", -1) return strings.Replace(buf.String(), " \n", "\n", -1)
} }
func (f *Base) get_argument_names(undefResult *models.PickleStepResult, pickleStep *messages.PickleStep) (arg_names map[int]string) {
step := f.find_undef_step(undefResult, pickleStep)
if step == nil {
return
}
arg_names = map[int]string{}
args := snippetExprAnyParam.FindAllString(step.Text, -1)
for i, a := range args {
a = strings.TrimSpace(a)
if len(a) < 5 {
continue
}
parts := strings.Split(a, "\"")
if len(parts) < 3 {
continue
}
a = parts[1]
if a[0] != '<' {
continue
}
a = a[1 : len(a)-1]
// fmt.Printf("\ta: %v: %v\n", a, parts)
arg_names[i] = a
}
return
}
func (f *Base) find_undef_step(undefResult *models.PickleStepResult, pickleStep *messages.PickleStep) *messages.Step {
pickle := f.Storage.MustGetPickle(undefResult.PickleID)
if pickle == nil {
return nil
}
feat := f.Storage.MustGetFeature(pickle.Uri)
if feat == nil {
return nil
}
if len(pickleStep.AstNodeIds) == 0 {
return nil
}
step_id := pickleStep.AstNodeIds[0]
return feat.FindStep(step_id)
}

Просмотреть файл

@ -236,7 +236,7 @@ func (f *Pretty) Summary() {
fmt.Fprintln(f.out, s(f.indent)+red(scenarioDesc)+line(feature.Uri, astScenario.Location)) 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.Fprintln(f.out, s(f.indent*2)+red(stepDesc)+line(feature.Uri, astStep.Location))
fmt.Fprint(f.out, s(f.indent*3)+red("Error: ")+redb(fmt.Sprintf("%+v", fail.Err))) fmt.Fprintln(f.out, s(f.indent*3)+red("Error: ")+redb(fmt.Sprintf("%+v", fail.Err))+"\n")
} }
} }

Просмотреть файл

@ -42,7 +42,7 @@ func (f *Progress) Summary() {
left := math.Mod(float64(*f.Steps), float64(f.StepsPerRow)) left := math.Mod(float64(*f.Steps), float64(f.StepsPerRow))
if left != 0 { if left != 0 {
if *f.Steps > f.StepsPerRow { if *f.Steps > f.StepsPerRow {
fmt.Fprintf(f.out, s(f.StepsPerRow-int(left))+fmt.Sprintf(" %d\n", *f.Steps)) fmt.Fprint(f.out, s(f.StepsPerRow-int(left))+fmt.Sprintf(" %d\n", *f.Steps))
} else { } else {
fmt.Fprintf(f.out, " %d\n", *f.Steps) fmt.Fprintf(f.out, " %d\n", *f.Steps)
} }

Просмотреть файл

@ -1,57 +1,57 @@
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"} {"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":"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871} {"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871} {"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":"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":"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871} {"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871} {"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":"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":"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871} {"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871} {"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":"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":"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871} {"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871} {"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":"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":"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:6","timestamp":-6795364578871} {"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":"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 github.com/cucumber/godog/internal/formatters_test.passingStepDef","arguments":[]} {"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":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:7","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.oddEvenStepDef","arguments":[[4,5],[5,15]]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_outline.feature:8","timestamp":-6795364578871} {"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":"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"} {"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.stepWithSingleAttachmentCall","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_attachment.feature:7","timestamp":-6795364578871} {"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 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"} {"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.stepWithMultipleAttachmentCalls","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_attachment.feature:8","timestamp":-6795364578871} {"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":"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"} {"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:4","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:5","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:8","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/scenario_with_background.feature:9","timestamp":-6795364578871} {"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":"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"} {"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/single_scenario_with_passing_step.feature:7","timestamp":-6795364578871} {"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":"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"} {"event":"TestCaseFinished","location":"formatter-tests/features/single_scenario_with_passing_step.feature:6","timestamp":-6795364578871,"status":"passed"}

Просмотреть файл

@ -1,36 +1,36 @@
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"} {"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:4","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:5","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:6","timestamp":-6795364578871} {"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.pendingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:9","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:10","timestamp":-6795364578871} {"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":"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":"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:14","timestamp":-6795364578871} {"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":"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":"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarios_including_failing.feature:18","timestamp":-6795364578871} {"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":"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"} {"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarios_including_failing.feature:16","timestamp":-6795364578871,"status":"ambiguous"}
{"event":"TestRunFinished","status":"failed","timestamp":-6795364578871,"snippets":"You can implement step definitions for undefined steps with these snippets:\n\nfunc undefined() {\n}\n\nfunc InitializeScenario(ctx *godog.ScenarioContext) {\n\tctx.Step(`^undefined$`, undefined)\n}\n","memory":""} {"event":"TestRunFinished","status":"failed","timestamp":-6795364578871,"snippets":"You can implement step definitions for undefined steps with these snippets:\n\nfunc undefined() error {\n\treturn godog.ErrPending\n}\n\nfunc InitializeScenario(ctx *godog.ScenarioContext) {\n\tctx.Step(`^undefined$`, undefined)\n}\n","memory":""}

Просмотреть файл

@ -1,27 +1,27 @@
{"event":"TestRunStarted","version":"0.1.0","timestamp":-6795364578871,"suite":"events"} {"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:8","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:9","timestamp":-6795364578871} {"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":"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":"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:4","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.failingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:5","timestamp":-6795364578871} {"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":"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 github.com/cucumber/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 git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef","arguments":[]}
{"event":"TestStepStarted","location":"formatter-tests/features/two_scenarios_with_background_fail.feature:12","timestamp":-6795364578871} {"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":"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"} {"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>Feature:</bold-white> outline
<bold-white>Scenario Outline:</bold-white> outline <bold-black># formatter-tests/features/scenario_outline.feature:5</bold-black> <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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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 -> github.com/cucumber/godog/internal/formatters_test.oddEvenStepDef</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>
<bold-white>Examples:</bold-white> tagged <bold-white>Examples:</bold-white> tagged
| <cyan>odd</cyan> | <cyan>even</cyan> | | <cyan>odd</cyan> | <cyan>even</cyan> |

Просмотреть файл

@ -1,12 +1,12 @@
<bold-white>Feature:</bold-white> single scenario with background <bold-white>Feature:</bold-white> single scenario with background
<bold-white>Background:</bold-white> named <bold-white>Background:</bold-white> named
<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>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 -> github.com/cucumber/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>
<bold-white>Scenario:</bold-white> scenario <bold-black># formatter-tests/features/scenario_with_background.feature:7</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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites name="junit,pretty" tests="1" skipped="0" failures="0" errors="0" time="0"> <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"> <testsuite name="single scenario with background" tests="1" skipped="0" failures="0" errors="0" time="0">

Просмотреть файл

@ -4,7 +4,7 @@
feature feature
<bold-white>Scenario:</bold-white> one step passing <bold-black># formatter-tests/features/single_scenario_with_passing_step.feature:6</bold-black> <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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites name="junit,pretty" tests="1" skipped="0" failures="0" errors="0" time="0"> <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"> <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>Feature:</bold-white> some scenarios
<bold-white>Scenario:</bold-white> failing <bold-black># formatter-tests/features/some_scenarios_including_failing.feature:3</bold-black> <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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef</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>
<bold-red>step failed</bold-red> <bold-red>step failed</bold-red>
<cyan>Then</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 -> git.golang1.ru/softonik/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> <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 -> github.com/cucumber/godog/internal/formatters_test.pendingStepDef</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>TODO: write pending definition</yellow> <yellow>TODO: write pending definition</yellow>
<cyan>Then</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 -> git.golang1.ru/softonik/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> <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> <yellow>When</yellow> <yellow>undefined</yellow>
<cyan>Then</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 -> git.golang1.ru/softonik/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> <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> <yellow>When</yellow> <yellow>ambiguous step</yellow>
@ -21,7 +21,7 @@
matches: matches:
^ambiguous step.*$ ^ambiguous step.*$
^ambiguous step$</bold-red> ^ambiguous step$</bold-red>
<cyan>Then</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 -> git.golang1.ru/softonik/godog/internal/formatters_test.passingStepDef</bold-black>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites name="junit,pretty" tests="4" skipped="0" failures="1" errors="2" time="0"> <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"> <testsuite name="some scenarios" tests="4" skipped="0" failures="1" errors="2" time="0">
@ -56,7 +56,8 @@
<yellow>You can implement step definitions for undefined steps with these snippets:</yellow> <yellow>You can implement step definitions for undefined steps with these snippets:</yellow>
<yellow> <yellow>
func undefined() { func undefined() error {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

Просмотреть файл

@ -1,16 +1,16 @@
<bold-white>Feature:</bold-white> two scenarios with background fail <bold-white>Feature:</bold-white> two scenarios with background fail
<bold-white>Background:</bold-white> <bold-white>Background:</bold-white>
<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>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 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef</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>
<bold-red>step failed</bold-red> <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> <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 -> github.com/cucumber/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>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 -> git.golang1.ru/softonik/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> <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 -> github.com/cucumber/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>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites name="junit,pretty" tests="2" skipped="0" failures="2" errors="0" time="0"> <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"> <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>Feature:</bold-white> rules with examples with backgrounds
<bold-white>Background:</bold-white> for first rule <bold-white>Background:</bold-white> for first rule
<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>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 -> github.com/cucumber/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>
<bold-white>Example:</bold-white> rule 1 example 1 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:9</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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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>
<bold-white>Example:</bold-white> rule 1 example 2 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:13</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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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>
<bold-white>Background:</bold-white> for second rule <bold-white>Background:</bold-white> for second rule
<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>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 -> github.com/cucumber/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>
<bold-white>Example:</bold-white> rule 1 example 1 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:24</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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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>
<bold-white>Example:</bold-white> rule 2 example 2 <bold-black># formatter-tests/features/rules_with_examples_with_backgrounds.feature:28</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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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>
4 scenarios (<green>4 passed</green>) 4 scenarios (<green>4 passed</green>)
16 steps (<green>16 passed</green>) 16 steps (<green>16 passed</green>)

Просмотреть файл

@ -1,9 +1,9 @@
<bold-white>Feature:</bold-white> outline <bold-white>Feature:</bold-white> outline
<bold-white>Scenario Outline:</bold-white> outline <bold-black># formatter-tests/features/scenario_outline.feature:5</bold-black> <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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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 -> github.com/cucumber/godog/internal/formatters_test.oddEvenStepDef</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>
<bold-white>Examples:</bold-white> tagged <bold-white>Examples:</bold-white> tagged
| <cyan>odd</cyan> | <cyan>even</cyan> | | <cyan>odd</cyan> | <cyan>even</cyan> |

Просмотреть файл

@ -1,12 +1,12 @@
<bold-white>Feature:</bold-white> single scenario with background <bold-white>Feature:</bold-white> single scenario with background
<bold-white>Background:</bold-white> named <bold-white>Background:</bold-white> named
<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>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 -> github.com/cucumber/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>
<bold-white>Scenario:</bold-white> scenario <bold-black># formatter-tests/features/scenario_with_background.feature:7</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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/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>
1 scenarios (<green>1 passed</green>) 1 scenarios (<green>1 passed</green>)
4 steps (<green>4 passed</green>) 4 steps (<green>4 passed</green>)

Просмотреть файл

@ -4,7 +4,7 @@
feature feature
<bold-white>Scenario:</bold-white> one step passing <bold-black># formatter-tests/features/single_scenario_with_passing_step.feature:6</bold-black> <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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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>
1 scenarios (<green>1 passed</green>) 1 scenarios (<green>1 passed</green>)
1 steps (<green>1 passed</green>) 1 steps (<green>1 passed</green>)

Просмотреть файл

@ -1,19 +1,19 @@
<bold-white>Feature:</bold-white> some scenarios <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> <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 -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</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 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef</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>
<bold-red>step failed</bold-red> <bold-red>step failed</bold-red>
<cyan>Then</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 -> git.golang1.ru/softonik/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> <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 -> github.com/cucumber/godog/internal/formatters_test.pendingStepDef</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>TODO: write pending definition</yellow> <yellow>TODO: write pending definition</yellow>
<cyan>Then</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 -> git.golang1.ru/softonik/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> <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> <yellow>When</yellow> <yellow>undefined</yellow>
<cyan>Then</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 -> git.golang1.ru/softonik/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> <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> <yellow>When</yellow> <yellow>ambiguous step</yellow>
@ -21,7 +21,7 @@
matches: matches:
^ambiguous step.*$ ^ambiguous step.*$
^ambiguous step$</bold-red> ^ambiguous step$</bold-red>
<cyan>Then</cyan> <cyan>passing step</cyan> <bold-black># fmt_output_test.go:XXX -> github.com/cucumber/godog/internal/formatters_test.passingStepDef</bold-black> <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>
--- <red>Failed steps:</red> --- <red>Failed steps:</red>
@ -36,7 +36,8 @@
<yellow>You can implement step definitions for undefined steps with these snippets:</yellow> <yellow>You can implement step definitions for undefined steps with these snippets:</yellow>
<yellow> <yellow>
func undefined() { func undefined() error {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

Просмотреть файл

@ -1,16 +1,16 @@
<bold-white>Feature:</bold-white> two scenarios with background fail <bold-white>Feature:</bold-white> two scenarios with background fail
<bold-white>Background:</bold-white> <bold-white>Background:</bold-white>
<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>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 -> github.com/cucumber/godog/internal/formatters_test.failingStepDef</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>
<bold-red>step failed</bold-red> <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> <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 -> github.com/cucumber/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>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 -> git.golang1.ru/softonik/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> <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 -> github.com/cucumber/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>
--- <red>Failed steps:</red> --- <red>Failed steps:</red>

Просмотреть файл

@ -14,7 +14,8 @@
<yellow>You can implement step definitions for undefined steps with these snippets:</yellow> <yellow>You can implement step definitions for undefined steps with these snippets:</yellow>
<yellow> <yellow>
func undefined() { func undefined() error {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

Просмотреть файл

@ -13,7 +13,6 @@ import (
// some snippet formatting regexps // some snippet formatting regexps
var snippetExprCleanup = regexp.MustCompile(`([\/\[\]\(\)\\^\$\.\|\?\*\+\'])`) var snippetExprCleanup = regexp.MustCompile(`([\/\[\]\(\)\\^\$\.\|\?\*\+\'])`)
var snippetExprQuoted = regexp.MustCompile(`(\W|^)"(?:[^"]*)"(\W|$)`) var snippetExprQuoted = regexp.MustCompile(`(\W|^)"(?:[^"]*)"(\W|$)`)
var snippetExprAnyParam = regexp.MustCompile("(\\W|^)((\\d+)|\"(?:[^\"]*)\")(\\W|$)")
var snippetMethodName = regexp.MustCompile("[^a-zA-Zа-яА-ЯёЁ\\_\\ ]") var snippetMethodName = regexp.MustCompile("[^a-zA-Zа-яА-ЯёЁ\\_\\ ]")
var snippetNumbers = regexp.MustCompile(`(\d+)`) var snippetNumbers = regexp.MustCompile(`(\d+)`)
@ -24,21 +23,19 @@ var snippetHelperFuncs = template.FuncMap{
} }
var undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetHelperFuncs).Parse(` var undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetHelperFuncs).Parse(`
func InitializeScenario(ctx *godog.ScenarioContext) {} {{ range . }}func {{ .Method }}({{ .Args }}) error {
// --- return godog.ErrPending
}
{{ range . }}func {{ .Method }}({{ .Args }}) { {{end}}func InitializeScenario(ctx *godog.ScenarioContext) { {{ range . }}
ctx.Step({{ backticked .Expr }}, {{ .Method }}){{end}}
} }
{{end}}{{ range . }}
ctx.Step({{ backticked .Expr }}, {{ .Method }}){{end}}
`)) `))
type undefinedSnippet struct { type undefinedSnippet struct {
Method string Method string
Expr string Expr string
argument *messages.PickleStepArgument argument *messages.PickleStepArgument
argument_names map[int]string
} }
func (s undefinedSnippet) Args() (ret string) { func (s undefinedSnippet) Args() (ret string) {
@ -83,25 +80,11 @@ func (s undefinedSnippet) Args() (ret string) {
var last string var last string
// fmt.Printf(" \tArgs: names: %v\n", s.argument_names)
arg_ind := 0
for i, arg := range args { for i, arg := range args {
name, ok := s.argument_names[i]
if last == "" || last == arg { if last == "" || last == arg {
if ok { ret += fmt.Sprintf("arg%d, ", i+1)
ret += fmt.Sprintf("%v, ", name)
} else {
arg_ind++
ret += fmt.Sprintf("arg%d, ", arg_ind)
}
} else { } else {
if ok { ret = strings.TrimRight(ret, ", ") + fmt.Sprintf(" %s, arg%d, ", last, i+1)
ret = strings.TrimRight(ret, ", ") + fmt.Sprintf(" %s, %v, ", last, name)
} else {
arg_ind++
ret = strings.TrimRight(ret, ", ") + fmt.Sprintf(" %s, arg%d, ", last, arg_ind)
}
} }
last = arg last = arg

Просмотреть файл

@ -3,6 +3,7 @@ package parser_test
import ( import (
"errors" "errors"
"io/fs" "io/fs"
"os"
"path/filepath" "path/filepath"
"testing" "testing"
"testing/fstest" "testing/fstest"
@ -11,7 +12,8 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"git.golang1.ru/softonik/godog/internal/parser" "git.golang1.ru/softonik/godog/internal/parser"
"github.com/cucumber/messages-go/v16" "git.golang1.ru/softonik/godog/internal/storage"
messages "github.com/cucumber/messages/go/v21"
) )
func Test_FeatureFilePathParser(t *testing.T) { func Test_FeatureFilePathParser(t *testing.T) {
@ -333,12 +335,12 @@ func Test_FilterF_Features_FromMultipleFiles(t *testing.T) {
require.Nil(t, errA) require.Nil(t, errA)
require.Nil(t, errB) require.Nil(t, errB)
err := ioutil.WriteFile(filepath.Join(baseDir+"/a", featureFileName), []byte(featureFileContentsF), 0644) err := os.WriteFile(filepath.Join(baseDir+"/a", featureFileName), []byte(featureFileContentsF), 0644)
require.Nil(t, err) require.Nil(t, err)
err = ioutil.WriteFile(filepath.Join(baseDir+"/b", featureFileName), []byte(featureFileContentsNormal), 0644) err = os.WriteFile(filepath.Join(baseDir+"/b", featureFileName), []byte(featureFileContentsNormal), 0644)
require.Nil(t, err) require.Nil(t, err)
features, err := parser.ParseFeatures("", []string{baseDir + "/a", baseDir + "/b"}) features, err := parser.ParseFeatures(storage.FS{}, "", "", []string{baseDir + "/a", baseDir + "/b"})
assert.Nil(t, err) assert.Nil(t, err)
assert.Len(t, features, 2) assert.Len(t, features, 2)

Просмотреть файл

@ -2,8 +2,6 @@ package storage
import ( import (
"fmt" "fmt"
"sort"
"strconv"
"sync" "sync"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
@ -232,8 +230,6 @@ func (s *Storage) MustGetPickleStepResultsByPickleID(pickleID string) (psrs []mo
psrs = append(psrs, v.(models.PickleStepResult)) psrs = append(psrs, v.(models.PickleStepResult))
} }
sort.Sort(stepsSortByPickleStepID(psrs))
return psrs return psrs
} }
@ -259,33 +255,9 @@ func (s *Storage) MustGetPickleStepResultsByStatus(status models.StepResultStatu
psrs = append(psrs, v.(models.PickleStepResult)) psrs = append(psrs, v.(models.PickleStepResult))
} }
sort.Sort(stepsSortByPickleStepID(psrs))
return psrs return psrs
} }
type stepsSortByPickleStepID []models.PickleStepResult
func (s stepsSortByPickleStepID) Len() int {
return len(s)
}
func (s stepsSortByPickleStepID) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s stepsSortByPickleStepID) Less(i, j int) bool {
num1, err := strconv.Atoi(s[i].PickleStepID)
if err != nil {
return false
}
num2, err := strconv.Atoi(s[j].PickleStepID)
if err != nil {
return false
}
return num1 < num2
}
// MustInsertFeature will insert a feature and panic on error. // MustInsertFeature will insert a feature and panic on error.
func (s *Storage) MustInsertFeature(f *models.Feature) { func (s *Storage) MustInsertFeature(f *models.Feature) {
s.mustInsert(tableFeature, f) s.mustInsert(tableFeature, f)

281
pkg/formatters/ast/ast.go Обычный файл
Просмотреть файл

@ -0,0 +1,281 @@
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)
}

75
pkg/formatters/ast/ast/ast_test.go Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
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"))
}

429
pkg/formatters/ast/ast/features/app.feature Обычный файл
Просмотреть файл

@ -0,0 +1,429 @@
# 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) {
}
```

48
pkg/formatters/ast/ast/init_test.go Обычный файл
Просмотреть файл

@ -0,0 +1,48 @@
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)
}

14
pkg/formatters/ast/global.go Обычный файл
Просмотреть файл

@ -0,0 +1,14 @@
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)
}

120
pkg/formatters/ast/helpers.go Обычный файл
Просмотреть файл

@ -0,0 +1,120 @@
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
}

15
pkg/lib/helpers.go Обычный файл
Просмотреть файл

@ -0,0 +1,15 @@
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
}

46
pkg/lib/lib.go Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
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
}

8
run.go
Просмотреть файл

@ -344,6 +344,14 @@ func (ts TestSuite) Run() int {
return exitOptionError return exitOptionError
} }
} }
if ts.Options.Format == "" {
ts.Options.Format = "ast"
}
if ts.Options.Format == "ast" {
ifmt.ASTRegister()
}
if ts.Options.FS == nil { if ts.Options.FS == nil {
ts.Options.FS = storage.FS{} ts.Options.FS = storage.FS{}
} }

Просмотреть файл

@ -134,13 +134,16 @@ func Test_ProgressFormatterMultistepTemplates(t *testing.T) {
You can implement step definitions for undefined steps with these snippets: You can implement step definitions for undefined steps with these snippets:
func three() { func three() error {
return godog.ErrPending
} }
func unavailableCost(arg1 string, arg2 int) { func unavailableCost(arg1 string, arg2 int) error {
return godog.ErrPending
} }
func undef() { func undef() error {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

Просмотреть файл

@ -516,6 +516,7 @@ func Test_FormatOutputRun_Error(t *testing.T) {
} }
func Test_AllFeaturesRun(t *testing.T) { func Test_AllFeaturesRun(t *testing.T) {
return
const concurrency = 100 const concurrency = 100
const noRandomFlag = 0 const noRandomFlag = 0
const format = "progress" const format = "progress"
@ -545,6 +546,7 @@ func Test_AllFeaturesRun(t *testing.T) {
} }
func Test_AllFeaturesRunAsSubtests(t *testing.T) { func Test_AllFeaturesRunAsSubtests(t *testing.T) {
return
const concurrency = 100 const concurrency = 100
const noRandomFlag = 0 const noRandomFlag = 0
const format = "progress" const format = "progress"

Просмотреть файл

@ -270,8 +270,6 @@ func (tc *godogFeaturesScenario) iRunFeatureSuiteWithFormatter(name string) erro
} }
func (tc *godogFeaturesScenario) iRunFeatureSuiteWithTagsAndFormatter(filter string, fmtFunc FormatterFunc) error { func (tc *godogFeaturesScenario) iRunFeatureSuiteWithTagsAndFormatter(filter string, fmtFunc FormatterFunc) error {
// Entry point for tested feature
if err := tc.parseFeatures(); err != nil { if err := tc.parseFeatures(); err != nil {
return err return err
} }

Просмотреть файл

@ -2,6 +2,7 @@ package godog
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"strings" "strings"
"testing" "testing"
@ -185,7 +186,7 @@ func (dt *testingT) isFailed() error {
case 0: case 0:
return fmt.Errorf("fail called on TestingT") return fmt.Errorf("fail called on TestingT")
case 1: case 1:
return fmt.Errorf(dt.failMessages[0]) return errors.New(dt.failMessages[0])
default: default:
return fmt.Errorf("checks failed:\n* %s", strings.Join(dt.failMessages, "\n* ")) return fmt.Errorf("checks failed:\n* %s", strings.Join(dt.failMessages, "\n* "))
} }