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

...

28 коммитов

Автор 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
Dominik Gedon
74fa488023
Replace deprecated ::set-output (#681)
As per the deprecation warning and explanation at https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2025-03-24 11:05:30 +01:00
Tighearnán Carroll
4a4fd8ab3a
fix(errors): Fix expected Step argument count for steps with context.Context (#679)
* fix(errors): print correct number of expected steps when step has  defined

* add unit test

* remove duplicate part from unit test

* update changelog
2025-03-19 23:04:06 +00:00
renovate[bot]
e03da742a5
fix(deps): update module github.com/spf13/pflag to v1.0.6 (#675)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-30 23:24:31 +00:00
Ahmadreza
14fe127e3d
Update honnef.co/go/tools/cmd/staticcheck version in Makefile (#670) 2024-12-19 11:12:33 +01:00
Viacheslav Poturaev
e55eab64f7
Add details to "step is undefined" error (#669)
* Add details to "step is undefined" error

* Update changelog
2024-12-10 16:54:49 +01:00
GrindStone
da4633a421
Localisation support (#665)
* Add dialect options to support localisation

* Add test for ParseFeatures support for localisation
2024-11-14 10:42:18 +01:00
Tighearnán Carroll
c5a88f62c2
fix(formatter): On concurrent execution, execute formatter at end of Scenario (#645)
* fix(formatter): add onflush logger only print output at end of scenario when running concurrently

* add to changelog

* fix tests

* fix scenario outline output for the Pretty formatter

* fix casing for linter

* add coverage for new storage function

* relate suite back to where it was originally

* better type assertion on flush log

* var name for asserted formatter that doesn't clash with stdlib's fmt

* add coverage to summary

* only defer flush func when running concurrently

* much more concise way of deferring the flush

---------

Co-authored-by: Viacheslav Poturaev <vearutop@gmail.com>
2024-11-08 17:05:40 +01:00
renovate[bot]
9b699ff9a8
fix(deps): update module github.com/cucumber/godog to v0.15.0 (#661)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-02 01:42:01 +00:00
108 изменённых файлов: 2865 добавлений и 322 удалений

2
.github/workflows/gorelease.yml предоставленный
Просмотреть файл

@ -33,7 +33,7 @@ jobs:
OUTPUT=$(gorelease 2>&1 || exit 0) OUTPUT=$(gorelease 2>&1 || exit 0)
echo "${OUTPUT}" echo "${OUTPUT}"
OUTPUT="${OUTPUT//$'\n'/%0A}" OUTPUT="${OUTPUT//$'\n'/%0A}"
echo "::set-output name=report::$OUTPUT" echo "report=$OUTPUT" >> $GITHUB_OUTPUT
- name: Comment Report - name: Comment Report
continue-on-error: true continue-on-error: true
uses: marocchino/sticky-pull-request-comment@v2 uses: marocchino/sticky-pull-request-comment@v2

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

@ -8,6 +8,16 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
## Unreleased ## Unreleased
### Added
- Step text is added to "step is undefined" error - ([669](https://github.com/cucumber/godog/pull/669) - [vearutop](https://github.com/vearutop))
### Changed
- Replace deprecated `::set-output` - ([681](https://github.com/cucumber/godog/pull/681) - [nodeg](https://github.com/nodeg))
### Fixed
- fix(errors): fix(errors): Fix expected Step argument count for steps with `context.Context` ([679](https://github.com/cucumber/godog/pull/679) - [tigh-latte](https://github.com/tigh-latte))
- fix(formatter): On concurrent execution, execute formatter at end of Scenario - ([645](https://github.com/cucumber/godog/pull/645) - [tigh-latte](https://github.com/tigh-latte))
## [v0.15.0] ## [v0.15.0]
### Added ### Added

138
Magefile.go Обычный файл
Просмотреть файл

@ -0,0 +1,138 @@
//go:build mage
// +build mage
package main
import (
// mage:import
. "magefile/docker"
)
var (
GolangVolume = "golang.upstream"
)
func init() {
AppName = "godog"
ImageName = "my/go"
}
func Test() {
TestNative()
}
func TestNative() {
Bash(`sudo docker run -ti --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
\
-v /gopath:/gopath:rw \
-v ${PWD}:/app \
\
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + ImageName + " -c '" + `\
go test -race -count=1 ./... \
'`)
}
func TestMakefile() {
Bash(`sudo docker run -ti --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
\
-v /gopath:/gopath:rw \
-v ${PWD}:/app \
\
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + ImageName + " -c '" + `set -x; \
make test \
'`)
}
func TestSnippets() {
Bash(`sudo docker run -ti --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
\
-v /gopath:/gopath:rw \
-v ${PWD}:/app \
\
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + ImageName + " -c '" + `set -x; \
godog run -f progress -c 4 \
features/snippets.feature \
'`)
}
func TestTags() {
Bash(`sudo docker run -ti --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
\
-v /gopath:/gopath:rw \
-v ${PWD}:/app \
\
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + ImageName + " -c '" + `set -x; \
godog run -f progress -c 4 \
features/tags.feature \
'`)
}
func Install() {
Bash(`sudo docker run -ti --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
\
-v /gopath:/gopath:rw \
-v ${PWD}:/app \
\
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + ImageName + " -c '" + `set -x; \
go install ./cmd/godog \
'`)
}

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

@ -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.4.7 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.4.7 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 ..

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

@ -1,4 +1,3 @@
[![#StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://vshymanskyy.github.io/StandWithUkraine)
[![Build Status](https://github.com/cucumber/godog/workflows/test/badge.svg)](https://github.com/cucumber/godog/actions?query=branch%main+workflow%3Atest) [![Build Status](https://github.com/cucumber/godog/workflows/test/badge.svg)](https://github.com/cucumber/godog/actions?query=branch%main+workflow%3Atest)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/cucumber/godog)](https://pkg.go.dev/github.com/cucumber/godog) [![PkgGoDev](https://pkg.go.dev/badge/github.com/cucumber/godog)](https://pkg.go.dev/github.com/cucumber/godog)
[![codecov](https://codecov.io/gh/cucumber/godog/branch/master/graph/badge.svg)](https://codecov.io/gh/cucumber/godog) [![codecov](https://codecov.io/gh/cucumber/godog/branch/master/graph/badge.svg)](https://codecov.io/gh/cucumber/godog)

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

@ -44,7 +44,7 @@ Now we have described a success case and an error when the request method is not
Execute `godog run`. You should see the following result, which says that all of our 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

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

@ -5,7 +5,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) {

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

@ -9,7 +9,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
type apiFeature struct { type apiFeature struct {

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

@ -5,8 +5,8 @@ import (
"os" "os"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

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

@ -11,8 +11,8 @@ import (
"os" "os"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
) )
var opts = godog.Options{ var opts = godog.Options{

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

@ -5,7 +5,7 @@ import (
"io" "io"
"math" "math"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
const ( const (

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

@ -6,8 +6,8 @@ import (
"os" "os"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
flag "github.com/spf13/pflag" flag "github.com/spf13/pflag"
) )

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

@ -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,

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

@ -11,7 +11,7 @@ import (
"strings" "strings"
txdb "github.com/DATA-DOG/go-txdb" txdb "github.com/DATA-DOG/go-txdb"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func init() { func init() {

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

@ -1,14 +1,14 @@
module github.com/cucumber/godog/_examples module git.golang1.ru/softonik/godog/_examples
go 1.16 go 1.16
replace github.com/cucumber/godog => ../ replace git.golang1.ru/softonik/godog => ../
require ( require (
github.com/DATA-DOG/go-txdb v0.1.6 github.com/DATA-DOG/go-txdb v0.1.6
github.com/cucumber/godog v0.14.1 git.golang1.ru/softonik/godog v0.15.0
github.com/go-sql-driver/mysql v1.7.1 github.com/go-sql-driver/mysql v1.7.1
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.8.2 github.com/stretchr/testify v1.8.2
) )

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

@ -45,6 +45,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/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 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/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=

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

@ -15,12 +15,12 @@ import (
"context" "context"
"flag" "flag"
"fmt" "fmt"
"github.com/cucumber/godog/_examples/godogs" "git.golang1.ru/softonik/godog/_examples/godogs"
"os" "os"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
) )
var opts = godog.Options{ var opts = godog.Options{

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

@ -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:

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

@ -2,6 +2,6 @@ module incorrect-project-structure
go 1.13 go 1.13
require github.com/cucumber/godog v0.14.1 require git.golang1.ru/softonik/godog v0.15.0
replace github.com/cucumber/godog => ../../ replace git.golang1.ru/softonik/godog => ../../

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

@ -1,6 +1,6 @@
package main package main
import "github.com/cucumber/godog" import "git.golang1.ru/softonik/godog"
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

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

@ -5,8 +5,8 @@ import (
"go/build" "go/build"
"path/filepath" "path/filepath"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/builder" "git.golang1.ru/softonik/godog/internal/builder"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -40,7 +40,7 @@ The test runner can be executed with the same flags as when using godog run.`,
func buildCmdRunFunc(cmd *cobra.Command, args []string) error { func buildCmdRunFunc(cmd *cobra.Command, args []string) error {
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead.")) fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details.")) fmt.Println(colors.Yellow("See https://git.golang1.ru/softonik/godog/discussions/478 for details."))
bin, err := filepath.Abs(buildOutput) bin, err := filepath.Abs(buildOutput)
if err != nil { if err != nil {

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

@ -4,7 +4,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
) )
var version bool var version bool

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

@ -9,9 +9,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/builder" "git.golang1.ru/softonik/godog/internal/builder"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
) )
var opts flags.Options var opts flags.Options
@ -44,7 +44,7 @@ buildable go source.`,
func runCmdRunFunc(cmd *cobra.Command, args []string) error { func runCmdRunFunc(cmd *cobra.Command, args []string) error {
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead.")) fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details.")) fmt.Println(colors.Yellow("See https://git.golang1.ru/softonik/godog/discussions/478 for details."))
osArgs := os.Args[1:] osArgs := os.Args[1:]

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

@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
// CreateVersionCmd creates the version subcommand. // CreateVersionCmd creates the version subcommand.

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

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/cucumber/godog/cmd/godog/internal" "git.golang1.ru/softonik/godog/cmd/godog/internal"
) )
func main() { func main() {

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

@ -3,7 +3,7 @@ package godog_test
import ( import (
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func ExampleTestSuite_Run_subtests() { func ExampleTestSuite_Run_subtests() {

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

@ -153,3 +153,43 @@ Feature: undefined step snippets
ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts) ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts)
} }
""" """
Scenario: Для русских сценариев генерируются русские функции
Given a feature "undefined.feature" file:
"""
# language: ru
Функционал: суперфича
Сценарий: делает что-то полезное
Дано что-то
Когда я делаю ещё что-то
То получается ещё более что-то
"""
When I run feature suite
Then the following steps should be undefined:
"""
получается ещё более что-то
что-то
я делаю ещё что-то
"""
And the undefined step snippets should be:
"""
func получаетсяЕщёБолееЧтото() error {
return godog.ErrPending
}
func чтото() error {
return godog.ErrPending
}
func яДелаюЕщёЧтото() error {
return godog.ErrPending
}
func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото)
ctx.Step(`^что-то$`, чтото)
ctx.Step(`^я делаю ещё что-то$`, яДелаюЕщёЧтото)
}
"""

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

@ -125,3 +125,75 @@ Feature: tag filters
""" """
a feature path "four" a feature path "four"
""" """
Scenario: empty filter and scenarios with f-tag - are executed only
Given a feature "normal.feature" file:
"""
Feature: f-tagged
Scenario: one
Given a feature path "one"
Scenario: two
Given a feature path "two"
@f
Scenario: three
Given a feature path "three"
@f
Scenario: four
Given a feature path "four"
"""
When I run feature suite with tags ""
Then the suite should have passed
And I should have 2 scenario registered
And the following steps should be passed:
"""
a feature path "three"
a feature path "four"
"""
Scenario: two feature files and scenarios with f-tag - are executed only
Given a feature "normal.feature" file:
"""
Feature: f-tagged
Scenario: one
Given a feature path "one"
Scenario: two
Given a feature path "two"
@f
Scenario: three
Given a feature path "three"
@f
Scenario: four
Given a feature path "four"
"""
And a feature "another.feature" file:
"""
Feature: non-tagged
Scenario: five
Given a feature path "five"
Scenario: six
Given a feature path "six"
Scenario: seven
Given a feature path "seven"
Scenario: eight
Given a feature path "eight"
"""
When I run feature suite with tags ""
Then the suite should have passed
And I should have 2 scenario registered
And the following steps should be passed:
"""
a feature path "three"
a feature path "four"
"""

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

@ -8,8 +8,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
) )
// repeats a space n times // repeats a space n times
@ -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:"))

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

@ -7,8 +7,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/formatters" "git.golang1.ru/softonik/godog/internal/formatters"
) )
func TestFlagsShouldRandomizeAndGenerateSeed(t *testing.T) { func TestFlagsShouldRandomizeAndGenerateSeed(t *testing.T) {

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

@ -8,7 +8,7 @@ import (
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
) )
// Choose randomly assigns a convenient pseudo-random seed value. // Choose randomly assigns a convenient pseudo-random seed value.

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

@ -3,7 +3,7 @@ package godog
import ( import (
"testing" "testing"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

10
fmt.go
Просмотреть файл

@ -6,11 +6,11 @@ import (
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
internal_fmt "github.com/cucumber/godog/internal/formatters" internal_fmt "git.golang1.ru/softonik/godog/internal/formatters"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
"github.com/cucumber/godog/internal/storage" "git.golang1.ru/softonik/godog/internal/storage"
) )
// FindFmt searches available formatters registered // FindFmt searches available formatters registered

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

@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func Test_FindFmt(t *testing.T) { func Test_FindFmt(t *testing.T) {

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

@ -74,6 +74,12 @@ type Formatter interface {
Summary() Summary()
} }
// FlushFormatter is a `Formatter` but can be flushed.
type FlushFormatter interface {
Formatter
Flush()
}
// FormatterFunc builds a formatter with given // FormatterFunc builds a formatter with given
// suite name and io.Writer to record output // suite name and io.Writer to record output
type FormatterFunc func(string, io.Writer) Formatter type FormatterFunc func(string, io.Writer) Formatter

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

@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func Test_FindFmt(t *testing.T) { func Test_FindFmt(t *testing.T) {

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

@ -1,13 +1,27 @@
module github.com/cucumber/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.5 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 (

51
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,24 +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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
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=

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

@ -9,7 +9,7 @@ import (
var astContextSrc = `package main var astContextSrc = `package main
import ( import (
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func MyContext(s *godog.Suite) { func MyContext(s *godog.Suite) {
@ -18,7 +18,7 @@ func MyContext(s *godog.Suite) {
var astTwoContextSrc = `package lib var astTwoContextSrc = `package lib
import ( import (
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func ApiContext(s *godog.Suite) { func ApiContext(s *godog.Suite) {

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

@ -23,13 +23,13 @@ var (
compiler = filepath.Join(tooldir, "compile") compiler = filepath.Join(tooldir, "compile")
linker = filepath.Join(tooldir, "link") linker = filepath.Join(tooldir, "link")
gopaths = filepath.SplitList(build.Default.GOPATH) gopaths = filepath.SplitList(build.Default.GOPATH)
godogImportPath = "github.com/cucumber/godog" godogImportPath = "git.golang1.ru/softonik/godog"
// godep // godep
runnerTemplate = template.Must(template.New("testmain").Parse(`package main runnerTemplate = template.Must(template.New("testmain").Parse(`package main
import ( import (
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
{{if or .TestSuiteContexts .ScenarioContexts}}_test "{{.ImportPath}}"{{end}} {{if or .TestSuiteContexts .ScenarioContexts}}_test "{{.ImportPath}}"{{end}}
{{if or .XTestSuiteContexts .XScenarioContexts}}_xtest "{{.ImportPath}}_test"{{end}} {{if or .XTestSuiteContexts .XScenarioContexts}}_xtest "{{.ImportPath}}_test"{{end}}
{{if or .XTestSuiteContexts .XScenarioContexts}}"testing/internal/testdeps"{{end}} {{if or .XTestSuiteContexts .XScenarioContexts}}"testing/internal/testdeps"{{end}}
@ -70,7 +70,7 @@ func main() {
// temp file for import // temp file for import
tempFileTemplate = template.Must(template.New("temp").Parse(`package {{.Name}} tempFileTemplate = template.Must(template.New("temp").Parse(`package {{.Name}}
import "github.com/cucumber/godog" import "git.golang1.ru/softonik/godog"
var _ = godog.Version var _ = godog.Version
`)) `))

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

@ -12,8 +12,8 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/internal/builder" "git.golang1.ru/softonik/godog/internal/builder"
) )
func InitializeScenario(ctx *godog.ScenarioContext) {} func InitializeScenario(ctx *godog.ScenarioContext) {}
@ -51,7 +51,7 @@ var builderTestFile = `package godogs
import ( import (
"fmt" "fmt"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
func thereAreGodogs(available int) error { func thereAreGodogs(available int) error {
@ -91,7 +91,7 @@ var builderXTestFile = `package godogs_test
import ( import (
"fmt" "fmt"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"godogs" "godogs"
) )
@ -138,7 +138,7 @@ func main() {
var emptyBuilderTestFile = `package godogs var emptyBuilderTestFile = `package godogs
import "github.com/cucumber/godog" import "git.golang1.ru/softonik/godog"
func InitializeScenario(ctx *godog.ScenarioContext) {} func InitializeScenario(ctx *godog.ScenarioContext) {}
` `

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

@ -6,7 +6,7 @@ import (
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
) )
func Test_BindFlagsShouldRespectFlagDefaults(t *testing.T) { func Test_BindFlagsShouldRespectFlagDefaults(t *testing.T) {

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

@ -48,6 +48,9 @@ type Options struct {
// from feature files // from feature files
Tags string Tags string
// Dialect to be used to parse feature files. If not set, default to "en".
Dialect string
// The formatter name // The formatter name
Format string Format string

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

@ -11,9 +11,9 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
) )
var ( var (

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)
}

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

@ -13,11 +13,11 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
"github.com/cucumber/godog/internal/storage" "git.golang1.ru/softonik/godog/internal/storage"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
) )
// BaseFormatterFunc implements the FormatterFunc for the base formatter. // BaseFormatterFunc implements the FormatterFunc for the base formatter.
@ -238,7 +238,8 @@ func (f *Base) Snippets() string {
case i != 0: case i != 0:
w = strings.Title(w) w = strings.Title(w)
case len(w) > 0: case len(w) > 0:
w = string(unicode.ToLower(rune(w[0]))) + w[1:] r := []rune(w)
w = string(unicode.ToLower(r[0])) + string(r[1:])
} }
words = append(words, w) words = append(words, w)
} }

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

@ -7,8 +7,8 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -42,7 +42,7 @@ And step failed f2s3:4
Scenario: f2s4 Scenario: f2s4
When step passed f2s4:1 When step passed f2s4:1
Then step is undefined f2s4:2 Then something unknown happens f2s4:2
And step passed f2s4:3 And step passed f2s4:3
`)}, `)},
) )
@ -116,8 +116,8 @@ scenario "f2s3" passed
step invoked: "f2s4:1", passed step invoked: "f2s4:1", passed
step "step passed f2s4:1" finished with status passed step "step passed f2s4:1" finished with status passed
.Ustep "step is undefined f2s4:2" finished with status undefined .Ustep "something unknown happens f2s4:2" finished with status undefined
scenario "f2s4" ended with error "step is undefined" scenario "f2s4" ended with error "step is undefined: something unknown happens f2s4:2"
-step "step passed f2s4:3" finished with status skipped -step "step passed f2s4:3" finished with status skipped
13 13
@ -139,12 +139,12 @@ scenario "f2s4" ended with error "step is undefined"
You can implement step definitions for undefined steps with these snippets: You can implement step definitions for undefined steps with these snippets:
func stepIsUndefinedFS(arg1, arg2, arg3 int) error { func somethingUnknownHappensFS(arg1, arg2, arg3 int) error {
return godog.ErrPending return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`+"`"+`^step is undefined f(\d+)s(\d+):(\d+)$`+"`"+`, stepIsUndefinedFS) ctx.Step(`+"`"+`^something unknown happens f(\d+)s(\d+):(\d+)$`+"`"+`, somethingUnknownHappensFS)
} }
`, out.String()) `, out.String())

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

@ -7,7 +7,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
) )
type csiState int type csiState int

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

@ -19,8 +19,8 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
) )

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

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
) )

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

@ -0,0 +1,108 @@
package formatters
import (
"sync"
"git.golang1.ru/softonik/godog/formatters"
messages "github.com/cucumber/messages/go/v21"
)
// WrapOnFlush wrap a `formatters.Formatter` in a `formatters.FlushFormatter`, which only
// executes when `Flush` is called
func WrapOnFlush(fmt formatters.Formatter) formatters.FlushFormatter {
return &onFlushFormatter{
fmt: fmt,
fns: make([]func(), 0),
mu: &sync.Mutex{},
}
}
type onFlushFormatter struct {
fmt formatters.Formatter
fns []func()
mu *sync.Mutex
}
func (o *onFlushFormatter) Pickle(pickle *messages.Pickle) {
o.fns = append(o.fns, func() {
o.fmt.Pickle(pickle)
})
}
func (o *onFlushFormatter) Passed(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
o.fns = append(o.fns, func() {
o.fmt.Passed(pickle, step, definition)
})
}
// Ambiguous implements formatters.Formatter.
func (o *onFlushFormatter) Ambiguous(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition, err error) {
o.fns = append(o.fns, func() {
o.fmt.Ambiguous(pickle, step, definition, err)
})
}
// Defined implements formatters.Formatter.
func (o *onFlushFormatter) Defined(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
o.fns = append(o.fns, func() {
o.fmt.Defined(pickle, step, definition)
})
}
// Failed implements formatters.Formatter.
func (o *onFlushFormatter) Failed(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition, err error) {
o.fns = append(o.fns, func() {
o.fmt.Failed(pickle, step, definition, err)
})
}
// Feature implements formatters.Formatter.
func (o *onFlushFormatter) Feature(pickle *messages.GherkinDocument, p string, c []byte) {
o.fns = append(o.fns, func() {
o.fmt.Feature(pickle, p, c)
})
}
// Pending implements formatters.Formatter.
func (o *onFlushFormatter) Pending(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
o.fns = append(o.fns, func() {
o.fmt.Pending(pickle, step, definition)
})
}
// Skipped implements formatters.Formatter.
func (o *onFlushFormatter) Skipped(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
o.fns = append(o.fns, func() {
o.fmt.Skipped(pickle, step, definition)
})
}
// Summary implements formatters.Formatter.
func (o *onFlushFormatter) Summary() {
o.fns = append(o.fns, func() {
o.fmt.Summary()
})
}
// TestRunStarted implements formatters.Formatter.
func (o *onFlushFormatter) TestRunStarted() {
o.fns = append(o.fns, func() {
o.fmt.TestRunStarted()
})
}
// Undefined implements formatters.Formatter.
func (o *onFlushFormatter) Undefined(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
o.fns = append(o.fns, func() {
o.fmt.Undefined(pickle, step, definition)
})
}
// Flush the logs.
func (o *onFlushFormatter) Flush() {
o.mu.Lock()
defer o.mu.Unlock()
for _, fn := range o.fns {
fn()
}
}

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

@ -0,0 +1,53 @@
package formatters
import (
"testing"
"github.com/stretchr/testify/assert"
)
var flushMock = DummyFormatter{}
func TestFlushWrapOnFormatter(t *testing.T) {
flushMock.tt = t
fmt := WrapOnFlush(&flushMock)
fmt.Feature(document, str, byt)
fmt.TestRunStarted()
fmt.Pickle(pickle)
fmt.Defined(pickle, step, definition)
fmt.Passed(pickle, step, definition)
fmt.Skipped(pickle, step, definition)
fmt.Undefined(pickle, step, definition)
fmt.Failed(pickle, step, definition, err)
fmt.Pending(pickle, step, definition)
fmt.Ambiguous(pickle, step, definition, err)
fmt.Summary()
assert.Equal(t, 0, flushMock.CountFeature)
assert.Equal(t, 0, flushMock.CountTestRunStarted)
assert.Equal(t, 0, flushMock.CountPickle)
assert.Equal(t, 0, flushMock.CountDefined)
assert.Equal(t, 0, flushMock.CountPassed)
assert.Equal(t, 0, flushMock.CountSkipped)
assert.Equal(t, 0, flushMock.CountUndefined)
assert.Equal(t, 0, flushMock.CountFailed)
assert.Equal(t, 0, flushMock.CountPending)
assert.Equal(t, 0, flushMock.CountAmbiguous)
assert.Equal(t, 0, flushMock.CountSummary)
fmt.Flush()
assert.Equal(t, 1, flushMock.CountFeature)
assert.Equal(t, 1, flushMock.CountTestRunStarted)
assert.Equal(t, 1, flushMock.CountPickle)
assert.Equal(t, 1, flushMock.CountDefined)
assert.Equal(t, 1, flushMock.CountPassed)
assert.Equal(t, 1, flushMock.CountSkipped)
assert.Equal(t, 1, flushMock.CountUndefined)
assert.Equal(t, 1, flushMock.CountFailed)
assert.Equal(t, 1, flushMock.CountPending)
assert.Equal(t, 1, flushMock.CountAmbiguous)
assert.Equal(t, 1, flushMock.CountSummary)
}

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

@ -9,8 +9,8 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
) )
func init() { func init() {

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

@ -3,8 +3,8 @@ package formatters
import ( import (
"io" "io"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/storage" "git.golang1.ru/softonik/godog/internal/storage"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
) )

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

@ -4,7 +4,7 @@ import (
"errors" "errors"
"testing" "testing"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -24,7 +24,6 @@ var (
// TestRepeater tests the delegation of the repeater functions. // TestRepeater tests the delegation of the repeater functions.
func TestRepeater(t *testing.T) { func TestRepeater(t *testing.T) {
mock.tt = t mock.tt = t
f := make(repeater, 0) f := make(repeater, 0)
f = append(f, &mock) f = append(f, &mock)
@ -52,7 +51,6 @@ func TestRepeater(t *testing.T) {
assert.Equal(t, 2, mock.CountFailed) assert.Equal(t, 2, mock.CountFailed)
assert.Equal(t, 2, mock.CountPending) assert.Equal(t, 2, mock.CountPending)
assert.Equal(t, 2, mock.CountAmbiguous) assert.Equal(t, 2, mock.CountAmbiguous)
} }
type BaseFormatter struct { type BaseFormatter struct {
@ -73,6 +71,7 @@ type DummyFormatter struct {
CountFailed int CountFailed int
CountPending int CountPending int
CountAmbiguous int CountAmbiguous int
CountSummary int
} }
// SetStorage assigns gherkin data storage. // SetStorage assigns gherkin data storage.
@ -158,3 +157,8 @@ func (f *DummyFormatter) Ambiguous(p *messages.Pickle, s *messages.PickleStep, d
assert.Equal(f.tt, d, definition) assert.Equal(f.tt, d, definition)
f.CountAmbiguous++ f.CountAmbiguous++
} }
// Pickle receives scenario.
func (f *DummyFormatter) Summary() {
f.CountSummary++
}

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

@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
) )
const fmtOutputTestsFeatureDir = "formatter-tests/features" const fmtOutputTestsFeatureDir = "formatter-tests/features"
@ -24,7 +24,7 @@ var tT *testing.T
func Test_FmtOutput(t *testing.T) { func Test_FmtOutput(t *testing.T) {
tT = t tT = t
pkg := os.Getenv("GODOG_TESTED_PACKAGE") pkg := os.Getenv("GODOG_TESTED_PACKAGE")
os.Setenv("GODOG_TESTED_PACKAGE", "github.com/cucumber/godog") os.Setenv("GODOG_TESTED_PACKAGE", "git.golang1.ru/softonik/godog")
featureFiles, err := listFmtOutputTestsFeatureFiles() featureFiles, err := listFmtOutputTestsFeatureFiles()
require.Nil(t, err) require.Nil(t, err)

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

@ -10,9 +10,9 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
) )
func init() { func init() {
@ -243,7 +243,7 @@ func (f *Pretty) Summary() {
f.Base.Summary() f.Base.Summary()
} }
func (f *Pretty) printOutlineExample(pickle *messages.Pickle, backgroundSteps int) { func (f *Pretty) printOutlineExample(pickle *messages.Pickle, step *messages.PickleStep, backgroundSteps int) {
var errorMsg string var errorMsg string
var clr = green var clr = green
@ -255,7 +255,7 @@ func (f *Pretty) printOutlineExample(pickle *messages.Pickle, backgroundSteps in
printExampleHeader := exampleTable.TableBody[0].Id == exampleRow.Id printExampleHeader := exampleTable.TableBody[0].Id == exampleRow.Id
firstExamplesTable := astScenario.Examples[0].Location.Line == exampleTable.Location.Line firstExamplesTable := astScenario.Examples[0].Location.Line == exampleTable.Location.Line
pickleStepResults := f.Storage.MustGetPickleStepResultsByPickleID(pickle.Id) pickleStepResults := f.Storage.MustGetPickleStepResultsByPickleIDUntilStep(pickle.Id, step.Id)
firstExecutedScenarioStep := len(pickleStepResults) == backgroundSteps+1 firstExecutedScenarioStep := len(pickleStepResults) == backgroundSteps+1
if firstExamplesTable && printExampleHeader && firstExecutedScenarioStep { if firstExamplesTable && printExampleHeader && firstExecutedScenarioStep {
@ -419,7 +419,7 @@ func (f *Pretty) printStep(pickle *messages.Pickle, pickleStep *messages.PickleS
} }
if !astBackgroundStep && len(astScenario.Examples) > 0 { if !astBackgroundStep && len(astScenario.Examples) > 0 {
f.printOutlineExample(pickle, backgroundSteps) f.printOutlineExample(pickle, pickleStep, backgroundSteps)
return return
} }

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

@ -7,7 +7,7 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
) )
@ -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,35 +1,35 @@
{"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"}

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

@ -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">

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

@ -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>

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

@ -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>

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

@ -13,7 +13,7 @@ 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 snippetMethodName = regexp.MustCompile(`[^a-zA-Z\_\ ]`) var snippetMethodName = regexp.MustCompile("[^a-zA-Zа-яА-ЯёЁ\\_\\ ]")
var snippetNumbers = regexp.MustCompile(`(\d+)`) var snippetNumbers = regexp.MustCompile(`(\d+)`)
var snippetHelperFuncs = template.FuncMap{ var snippetHelperFuncs = template.FuncMap{

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

@ -4,7 +4,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
) )
// this zeroes the time throughout whole test suite // this zeroes the time throughout whole test suite

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

@ -3,8 +3,8 @@ package models_test
import ( import (
"testing" "testing"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
"github.com/cucumber/godog/internal/testutils" "git.golang1.ru/softonik/godog/internal/testutils"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

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

@ -3,8 +3,8 @@ package models
import ( import (
"time" "time"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/utils" "git.golang1.ru/softonik/godog/internal/utils"
) )
// TestRunStarted ... // TestRunStarted ...

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

@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/cucumber/godog/colors" "git.golang1.ru/softonik/godog/colors"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
) )
type stepResultStatusTestCase struct { type stepResultStatusTestCase struct {

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

@ -9,7 +9,7 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
) )
var typeOfBytes = reflect.TypeOf([]byte(nil)) var typeOfBytes = reflect.TypeOf([]byte(nil))
@ -54,7 +54,7 @@ func (sd *StepDefinition) Run(ctx context.Context) (context.Context, interface{}
} }
if len(sd.Args) < numIn { if len(sd.Args) < numIn {
return ctx, fmt.Errorf("%w: expected %d arguments, matched %d from step", ErrUnmatchedStepArgumentNumber, typ.NumIn(), len(sd.Args)) return ctx, fmt.Errorf("%w: expected %d arguments, matched %d from step", ErrUnmatchedStepArgumentNumber, numIn, len(sd.Args))
} }
for i := 0; i < numIn; i++ { for i := 0; i < numIn; i++ {

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

@ -11,9 +11,9 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/cucumber/godog" "git.golang1.ru/softonik/godog"
"github.com/cucumber/godog/formatters" "git.golang1.ru/softonik/godog/formatters"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
) )
@ -259,6 +259,26 @@ func TestArgumentCountChecks(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
} }
func TestArgumentCountChecksWithContext(t *testing.T) {
wasCalled := false
fn := func(ctx context.Context, a int, b int) {
wasCalled = true
}
def := &models.StepDefinition{
StepDefinition: formatters.StepDefinition{
Handler: fn,
},
HandlerValue: reflect.ValueOf(fn),
}
def.Args = []interface{}{"1"}
_, err := def.Run(context.Background())
assert.False(t, wasCalled)
assert.Equal(t, `func expected more arguments than given: expected 2 arguments, matched 1 from step`, err.(error).Error())
assert.True(t, errors.Is(err.(error), models.ErrUnmatchedStepArgumentNumber))
}
func TestShouldSupportIntTypes(t *testing.T) { func TestShouldSupportIntTypes(t *testing.T) {
var aActual int64 var aActual int64
var bActual int32 var bActual int32

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

@ -13,9 +13,9 @@ import (
gherkin "github.com/cucumber/gherkin/go/v26" gherkin "github.com/cucumber/gherkin/go/v26"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/cucumber/godog/internal/flags" "git.golang1.ru/softonik/godog/internal/flags"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
"github.com/cucumber/godog/internal/tags" "git.golang1.ru/softonik/godog/internal/tags"
) )
var pathLineRe = regexp.MustCompile(`:([\d]+)$`) var pathLineRe = regexp.MustCompile(`:([\d]+)$`)
@ -33,7 +33,7 @@ func ExtractFeaturePathLine(p string) (string, int) {
return retPath, line return retPath, line
} }
func parseFeatureFile(fsys fs.FS, path string, newIDFunc func() string) (*models.Feature, error) { func parseFeatureFile(fsys fs.FS, path, dialect string, newIDFunc func() string) (*models.Feature, error) {
reader, err := fsys.Open(path) reader, err := fsys.Open(path)
if err != nil { if err != nil {
return nil, err return nil, err
@ -42,7 +42,7 @@ func parseFeatureFile(fsys fs.FS, path string, newIDFunc func() string) (*models
defer reader.Close() defer reader.Close()
var buf bytes.Buffer var buf bytes.Buffer
gherkinDocument, err := gherkin.ParseGherkinDocument(io.TeeReader(reader, &buf), newIDFunc) gherkinDocument, err := gherkin.ParseGherkinDocumentForLanguage(io.TeeReader(reader, &buf), dialect, newIDFunc)
if err != nil { if err != nil {
return nil, fmt.Errorf("%s - %v", path, err) return nil, fmt.Errorf("%s - %v", path, err)
} }
@ -54,11 +54,11 @@ func parseFeatureFile(fsys fs.FS, path string, newIDFunc func() string) (*models
return &f, nil return &f, nil
} }
func parseBytes(path string, feature []byte, newIDFunc func() string) (*models.Feature, error) { func parseBytes(path string, feature []byte, dialect string, newIDFunc func() string) (*models.Feature, error) {
reader := bytes.NewReader(feature) reader := bytes.NewReader(feature)
var buf bytes.Buffer var buf bytes.Buffer
gherkinDocument, err := gherkin.ParseGherkinDocument(io.TeeReader(reader, &buf), newIDFunc) gherkinDocument, err := gherkin.ParseGherkinDocumentForLanguage(io.TeeReader(reader, &buf), dialect, newIDFunc)
if err != nil { if err != nil {
return nil, fmt.Errorf("%s - %v", path, err) return nil, fmt.Errorf("%s - %v", path, err)
} }
@ -70,7 +70,7 @@ func parseBytes(path string, feature []byte, newIDFunc func() string) (*models.F
return &f, nil return &f, nil
} }
func parseFeatureDir(fsys fs.FS, dir string, newIDFunc func() string) ([]*models.Feature, error) { func parseFeatureDir(fsys fs.FS, dir, dialect string, newIDFunc func() string) ([]*models.Feature, error) {
var features []*models.Feature var features []*models.Feature
return features, fs.WalkDir(fsys, dir, func(p string, f fs.DirEntry, err error) error { return features, fs.WalkDir(fsys, dir, func(p string, f fs.DirEntry, err error) error {
if err != nil { if err != nil {
@ -85,7 +85,7 @@ func parseFeatureDir(fsys fs.FS, dir string, newIDFunc func() string) ([]*models
return nil return nil
} }
feat, err := parseFeatureFile(fsys, p, newIDFunc) feat, err := parseFeatureFile(fsys, p, dialect, newIDFunc)
if err != nil { if err != nil {
return err return err
} }
@ -95,7 +95,7 @@ func parseFeatureDir(fsys fs.FS, dir string, newIDFunc func() string) ([]*models
}) })
} }
func parsePath(fsys fs.FS, path string, newIDFunc func() string) ([]*models.Feature, error) { func parsePath(fsys fs.FS, path, dialect string, newIDFunc func() string) ([]*models.Feature, error) {
var features []*models.Feature var features []*models.Feature
path, line := ExtractFeaturePathLine(path) path, line := ExtractFeaturePathLine(path)
@ -114,10 +114,10 @@ func parsePath(fsys fs.FS, path string, newIDFunc func() string) ([]*models.Feat
} }
if fi.IsDir() { if fi.IsDir() {
return parseFeatureDir(fsys, path, newIDFunc) return parseFeatureDir(fsys, path, dialect, newIDFunc)
} }
ft, err := parseFeatureFile(fsys, path, newIDFunc) ft, err := parseFeatureFile(fsys, path, dialect, newIDFunc)
if err != nil { if err != nil {
return features, err return features, err
} }
@ -146,14 +146,18 @@ func parsePath(fsys fs.FS, path string, newIDFunc func() string) ([]*models.Feat
} }
// ParseFeatures ... // ParseFeatures ...
func ParseFeatures(fsys fs.FS, filter string, paths []string) ([]*models.Feature, error) { func ParseFeatures(fsys fs.FS, filter, dialect string, paths []string) ([]*models.Feature, error) {
var order int var order int
if dialect == "" {
dialect = gherkin.DefaultDialect
}
featureIdxs := make(map[string]int) featureIdxs := make(map[string]int)
uniqueFeatureURI := make(map[string]*models.Feature) uniqueFeatureURI := make(map[string]*models.Feature)
newIDFunc := (&messages.Incrementing{}).NewId newIDFunc := (&messages.Incrementing{}).NewId
for _, path := range paths { for _, path := range paths {
feats, err := parsePath(fsys, path, newIDFunc) feats, err := parsePath(fsys, path, dialect, newIDFunc)
switch { switch {
case os.IsNotExist(err): case os.IsNotExist(err):
@ -182,21 +186,25 @@ func ParseFeatures(fsys fs.FS, filter string, paths []string) ([]*models.Feature
features[idx] = feature features[idx] = feature
} }
features = filterFeatures(filter, features) features = FilterFeatures(filter, features)
return features, nil return features, nil
} }
type FeatureContent = flags.Feature type FeatureContent = flags.Feature
func ParseFromBytes(filter string, featuresInputs []FeatureContent) ([]*models.Feature, error) { func ParseFromBytes(filter, dialect string, featuresInputs []FeatureContent) ([]*models.Feature, error) {
var order int var order int
if dialect == "" {
dialect = gherkin.DefaultDialect
}
featureIdxs := make(map[string]int) featureIdxs := make(map[string]int)
uniqueFeatureURI := make(map[string]*models.Feature) uniqueFeatureURI := make(map[string]*models.Feature)
newIDFunc := (&messages.Incrementing{}).NewId newIDFunc := (&messages.Incrementing{}).NewId
for _, f := range featuresInputs { for _, f := range featuresInputs {
ft, err := parseBytes(f.Name, f.Contents, newIDFunc) ft, err := parseBytes(f.Name, f.Contents, dialect, newIDFunc)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -217,19 +225,61 @@ func ParseFromBytes(filter string, featuresInputs []FeatureContent) ([]*models.F
features[idx] = feature features[idx] = feature
} }
features = filterFeatures(filter, features) features = FilterFeatures(filter, features)
return features, nil return features, nil
} }
func filterFeatures(filter string, features []*models.Feature) (result []*models.Feature) { func FilterFeatures(filter string, features []*models.Feature) (result []*models.Feature) {
focused := false
for _, ft := range features { for _, ft := range features {
ft.Pickles = tags.ApplyTagFilter(filter, ft.Pickles) ft.Pickles = tags.ApplyTagFilter(filter, ft.Pickles)
if containsFocusedPickle(ft.Pickles) {
focused = true
}
if ft.Feature != nil && len(ft.Pickles) > 0 { if ft.Feature != nil && len(ft.Pickles) > 0 {
result = append(result, ft) result = append(result, ft)
} }
} }
if !focused {
return
}
var resultF []*models.Feature
for _, ft := range result {
ft.Pickles = filterFocusedPickles(ft.Pickles)
resultF = append(resultF, ft)
}
return resultF
}
func containsFocusedPickle(pickles []*messages.Pickle) bool {
for _, p := range pickles {
if containsFocusedTag(p.Tags) {
return true
}
}
return false
}
func containsFocusedTag(tags []*messages.PickleTag) bool {
for _, t := range tags {
if t.Name == "@f" {
return true
}
}
return false
}
func filterFocusedPickles(pickles []*messages.Pickle) (result []*messages.Pickle) {
for _, p := range pickles {
if containsFocusedTag(p.Tags) {
result = append(result, p)
}
}
return return
} }

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

@ -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"
@ -10,7 +11,9 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cucumber/godog/internal/parser" "git.golang1.ru/softonik/godog/internal/parser"
"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) {
@ -54,7 +57,7 @@ Feature: eat godogs
{Name: "MyCoolDuplicatedFeature", Contents: []byte(eatGodogContents)}, {Name: "MyCoolDuplicatedFeature", Contents: []byte(eatGodogContents)},
} }
featureFromBytes, err := parser.ParseFromBytes("", input) featureFromBytes, err := parser.ParseFromBytes("", "", input)
require.NoError(t, err) require.NoError(t, err)
require.Len(t, featureFromBytes, 1) require.Len(t, featureFromBytes, 1)
} }
@ -80,7 +83,7 @@ Feature: eat godogs
}, },
} }
featureFromFile, err := parser.ParseFeatures(fsys, "", []string{baseDir}) featureFromFile, err := parser.ParseFeatures(fsys, "", "", []string{baseDir})
require.NoError(t, err) require.NoError(t, err)
require.Len(t, featureFromFile, 1) require.Len(t, featureFromFile, 1)
@ -88,7 +91,7 @@ Feature: eat godogs
{Name: filepath.Join(baseDir, featureFileName), Contents: []byte(eatGodogContents)}, {Name: filepath.Join(baseDir, featureFileName), Contents: []byte(eatGodogContents)},
} }
featureFromBytes, err := parser.ParseFromBytes("", input) featureFromBytes, err := parser.ParseFromBytes("", "", input)
require.NoError(t, err) require.NoError(t, err)
require.Len(t, featureFromBytes, 1) require.Len(t, featureFromBytes, 1)
@ -155,7 +158,7 @@ func Test_ParseFeatures_FromMultiplePaths(t *testing.T) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
t.Parallel() t.Parallel()
features, err := parser.ParseFeatures(test.fsys, "", test.paths) features, err := parser.ParseFeatures(test.fsys, "", "", test.paths)
if test.expError != nil { if test.expError != nil {
require.Error(t, err) require.Error(t, err)
require.EqualError(t, err, test.expError.Error()) require.EqualError(t, err, test.expError.Error())
@ -178,3 +181,183 @@ func Test_ParseFeatures_FromMultiplePaths(t *testing.T) {
}) })
} }
} }
func Test_ParseFeatures_Localisation(t *testing.T) {
tests := map[string]struct {
dialect string
contents string
}{
"english": {
dialect: "en",
contents: `
Feature: dummy
Rule: dummy
Background: dummy
Given dummy
When dummy
Then dummy
Scenario: dummy
Given dummy
When dummy
Then dummy
And dummy
But dummy
Example: dummy
Given dummy
When dummy
Then dummy
Scenario Outline: dummy
Given dummy
When dummy
Then dummy
`,
},
"afrikaans": {
dialect: "af",
contents: `
Funksie: dummy
Regel: dummy
Agtergrond: dummy
Gegewe dummy
Wanneer dummy
Dan dummy
Voorbeeld: dummy
Gegewe dummy
Wanneer dummy
Dan dummy
En dummy
Maar dummy
Voorbeelde: dummy
Gegewe dummy
Wanneer dummy
Dan dummy
Situasie Uiteensetting: dummy
Gegewe dummy
Wanneer dummy
Dan dummy
`,
},
"arabic": {
dialect: "ar",
contents: `
خاصية: dummy
Rule: dummy
الخلفية: dummy
بفرض dummy
متى dummy
اذاً dummy
مثال: dummy
بفرض dummy
متى dummy
اذاً dummy
و dummy
لكن dummy
امثلة: dummy
بفرض dummy
متى dummy
اذاً dummy
سيناريو مخطط: dummy
بفرض dummy
متى dummy
اذاً dummy
`,
},
"chinese simplified": {
dialect: "zh-CN",
contents: `
功能: dummy
规则: dummy
背景: dummy
假如 dummy
dummy
那么 dummy
场景: dummy
假如 dummy
dummy
那么 dummy
而且 dummy
但是 dummy
例子: dummy
假如 dummy
dummy
那么 dummy
场景大纲: dummy
假如 dummy
dummy
那么 dummy
`,
},
}
featureFileName := "godogs.feature"
baseDir := "base"
for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()
fsys := fstest.MapFS{
filepath.Join(baseDir, featureFileName): {
Data: []byte(test.contents),
Mode: fs.FileMode(0o644),
},
}
featureTestDialect, err := parser.ParseFeatures(fsys, "", test.dialect, []string{baseDir})
require.NoError(t, err)
require.Len(t, featureTestDialect, 1)
})
}
}
func Test_FilterF_Features_FromMultipleFiles(t *testing.T) {
const featureFileName = "godogs.feature"
const featureFileContentsF = `Feature: focused
@f
Scenario: Focused
Given something
When do
Then ok`
const featureFileContentsNormal = `Feature: normal
Scenario: normal
Given something
When do
Then ok`
baseDir := filepath.Join(os.TempDir(), t.Name(), "godogs")
errA := os.MkdirAll(baseDir+"/a", 0755)
errB := os.MkdirAll(baseDir+"/b", 0755)
defer os.RemoveAll(baseDir)
require.Nil(t, errA)
require.Nil(t, errB)
err := os.WriteFile(filepath.Join(baseDir+"/a", featureFileName), []byte(featureFileContentsF), 0644)
require.Nil(t, err)
err = os.WriteFile(filepath.Join(baseDir+"/b", featureFileName), []byte(featureFileContentsNormal), 0644)
require.Nil(t, err)
features, err := parser.ParseFeatures(storage.FS{}, "", "", []string{baseDir + "/a", baseDir + "/b"})
assert.Nil(t, err)
assert.Len(t, features, 2)
for _, f := range features {
for _, p := range f.Pickles {
if !containsFocusedTag(p.Tags) {
assert.Failf(t, "found not Focused pickle", "Found not Focused pickle", p.Tags)
}
}
}
}
func containsFocusedTag(tags []*messages.PickleTag) bool {
for _, t := range tags {
if t.Name == "@f" {
return true
}
}
return false
}

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

@ -10,7 +10,7 @@ import (
"testing" "testing"
"testing/fstest" "testing/fstest"
"github.com/cucumber/godog/internal/storage" "git.golang1.ru/softonik/godog/internal/storage"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

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

@ -7,7 +7,7 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/hashicorp/go-memdb" "github.com/hashicorp/go-memdb"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
) )
const ( const (
@ -223,7 +223,7 @@ func (s *Storage) MustGetPickleStepResult(id string) models.PickleStepResult {
return v.(models.PickleStepResult) return v.(models.PickleStepResult)
} }
// MustGetPickleStepResultsByPickleID will retrieve pickle strep results by pickle id and panic on error. // MustGetPickleStepResultsByPickleID will retrieve pickle step results by pickle id and panic on error.
func (s *Storage) MustGetPickleStepResultsByPickleID(pickleID string) (psrs []models.PickleStepResult) { func (s *Storage) MustGetPickleStepResultsByPickleID(pickleID string) (psrs []models.PickleStepResult) {
it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexPickleID, pickleID) it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexPickleID, pickleID)
for v := it.Next(); v != nil; v = it.Next() { for v := it.Next(); v != nil; v = it.Next() {
@ -233,6 +233,21 @@ func (s *Storage) MustGetPickleStepResultsByPickleID(pickleID string) (psrs []mo
return psrs return psrs
} }
// MustGetPickleStepResultsByPickleIDUntilStep will retrieve pickle step results by pickle id
// from 0..stepID for that pickle.
func (s *Storage) MustGetPickleStepResultsByPickleIDUntilStep(pickleID string, untilStepID string) (psrs []models.PickleStepResult) {
it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexPickleID, pickleID)
for v := it.Next(); v != nil; v = it.Next() {
psr := v.(models.PickleStepResult)
psrs = append(psrs, psr)
if psr.PickleStepID == untilStepID {
break
}
}
return psrs
}
// MustGetPickleStepResultsByStatus will retrieve pickle strep results by status and panic on error. // MustGetPickleStepResultsByStatus will retrieve pickle strep results by status and panic on error.
func (s *Storage) MustGetPickleStepResultsByStatus(status models.StepResultStatus) (psrs []models.PickleStepResult) { func (s *Storage) MustGetPickleStepResultsByStatus(status models.StepResultStatus) (psrs []models.PickleStepResult) {
it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexStatus, status) it := s.mustGet(tablePickleStepResult, tablePickleStepResultIndexStatus, status)

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

@ -7,9 +7,9 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
"github.com/cucumber/godog/internal/storage" "git.golang1.ru/softonik/godog/internal/storage"
"github.com/cucumber/godog/internal/testutils" "git.golang1.ru/softonik/godog/internal/testutils"
) )
func Test_MustGetPickle(t *testing.T) { func Test_MustGetPickle(t *testing.T) {
@ -128,6 +128,40 @@ func Test_MustGetPickleStepResultsByPickleID(t *testing.T) {
assert.Equal(t, expected, actual) assert.Equal(t, expected, actual)
} }
func Test_MustGetPickleStepResultsByPickleIDUntilStep(t *testing.T) {
s := storage.NewStorage()
const pickleID = "p1"
const stepID = "s2"
store := []models.PickleStepResult{
{
Status: models.Passed,
PickleID: pickleID,
PickleStepID: "s1",
},
{
Status: models.Passed,
PickleID: pickleID,
PickleStepID: "s2",
},
{
Status: models.Passed,
PickleID: pickleID,
PickleStepID: "s3",
},
}
for _, psr := range store {
s.MustInsertPickleStepResult(psr)
}
expected := store[:2]
actual := s.MustGetPickleStepResultsByPickleIDUntilStep(pickleID, stepID)
assert.Equal(t, expected, actual)
}
func Test_MustGetPickleStepResultsByStatus(t *testing.T) { func Test_MustGetPickleStepResultsByStatus(t *testing.T) {
s := storage.NewStorage() s := storage.NewStorage()

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

@ -10,6 +10,11 @@ import (
// array of pickles and returned the filtered list. // array of pickles and returned the filtered list.
func ApplyTagFilter(filter string, pickles []*messages.Pickle) []*messages.Pickle { func ApplyTagFilter(filter string, pickles []*messages.Pickle) []*messages.Pickle {
if filter == "" { if filter == "" {
ff := filterF(pickles)
if len(ff) > 0 {
return ff
}
return pickles return pickles
} }
@ -60,3 +65,15 @@ func contains(tags []*messages.PickleTag, tag string) bool {
return false return false
} }
func filterF(pickles []*messages.Pickle) []*messages.Pickle {
var result = []*messages.Pickle{}
for _, pickle := range pickles {
if contains(pickle.Tags, "f") {
result = append(result, pickle)
}
}
return result
}

37
internal/tags/tag_filter_f_test.go Обычный файл
Просмотреть файл

@ -0,0 +1,37 @@
package tags_test
import (
"testing"
"github.com/stretchr/testify/assert"
"git.golang1.ru/softonik/godog/internal/tags"
)
type testcaseF struct {
filter string
input []*pickle
expected []*pickle
}
var testdataNonF = []*pickle{p1n, p2n, p3n}
var testdataF = []*pickle{p1n, p2n, p3withF}
var p1n = &pickle{Id: "one", Tags: []*tag{}}
var p2n = &pickle{Id: "two", Tags: []*tag{{Name: "@wip"}}}
var p3n = &pickle{Id: "three", Tags: []*tag{}}
var p3withF = &pickle{Id: "three", Tags: []*tag{{Name: "@f"}}}
var testcasesF = []testcaseF{
{filter: "", input: testdataNonF, expected: testdataNonF},
{filter: "", input: testdataF, expected: []*pickle{p3withF}},
{filter: "@wip", input: testdataF, expected: []*pickle{p2n}},
}
func Test_ApplyTagFilterWithF(t *testing.T) {
for _, tc := range testcasesF {
t.Run("", func(t *testing.T) {
actual := tags.ApplyTagFilter(tc.filter, tc.input)
assert.Equal(t, tc.expected, actual)
})
}
}

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

@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/cucumber/godog/internal/tags" "git.golang1.ru/softonik/godog/internal/tags"
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
) )

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

@ -8,7 +8,7 @@ import (
messages "github.com/cucumber/messages/go/v21" messages "github.com/cucumber/messages/go/v21"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cucumber/godog/internal/models" "git.golang1.ru/softonik/godog/internal/models"
) )
// BuildTestFeature creates a feature for testing purpose. // BuildTestFeature creates a feature for testing purpose.

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

@ -1,6 +1,6 @@
package godog package godog
import "github.com/cucumber/godog/internal/flags" import "git.golang1.ru/softonik/godog/internal/flags"
// Options are suite run options // Options are suite run options
// flags are mapped to these options. // flags are mapped to these options.

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
}

Показаны не все изменённые файлы, т.к. их слишком много Показать больше