58 строки
1,2 КиБ
Go
58 строки
1,2 КиБ
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
. "my/go-translator/pkg/testgodoglib"
|
|
|
|
"github.com/cucumber/godog"
|
|
"github.com/cucumber/godog/colors"
|
|
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
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) {
|
|
if err == nil {
|
|
afterScenario()
|
|
}
|
|
|
|
return ctx, nil
|
|
})
|
|
InitializeGomegaForGodog(ctx)
|
|
_ = Ω
|
|
}
|
|
|
|
func InitializeSuite(tsc *godog.TestSuiteContext) {
|
|
tsc.BeforeSuite(beforeSuite)
|
|
tsc.AfterSuite(afterSuite)
|
|
}
|
|
|
|
func TestMain(t *testing.T) {
|
|
testUtils(t)
|
|
|
|
var opts = godog.Options{
|
|
Output: colors.Colored(os.Stdout),
|
|
Strict: true,
|
|
StopOnFailure: true,
|
|
TestingT: t,
|
|
}
|
|
|
|
godog.BindCommandLineFlags("godog.", &opts)
|
|
godog.TestSuite{
|
|
Name: "app",
|
|
TestSuiteInitializer: InitializeSuite,
|
|
ScenarioInitializer: InitializeScenario,
|
|
Options: &opts,
|
|
}.Run()
|
|
}
|