From fc084134a0b14292c4446e6b97679e2976a36712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnblad?= Date: Sat, 20 Jun 2020 22:50:25 +0200 Subject: [PATCH] Wrote Release Notes, updated CHANGELOG.md and versions in README.md and godog version const --- CHANGELOG.md | 12 +++ README.md | 30 +++---- _examples/api/features/version.feature | 2 +- godog.go | 2 +- release-notes/v0.10.0.md | 115 +++++++++++++++++++++++++ 5 files changed, 144 insertions(+), 17 deletions(-) create mode 100644 release-notes/v0.10.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 91372c1..167525a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt ## [Unreleased] +### Added + +### Changed + +### Deprecated + +### Removed + +### Fixed + +## [v0.10.0-rc1] + ### Added - Added concurrency support to the pretty formatter ([275](https://github.com/cucumber/godog/pull/275) - [lonnblad]) - Added concurrency support to the events formatter ([274](https://github.com/cucumber/godog/pull/274) - [lonnblad]) diff --git a/README.md b/README.md index a0859a6..6de6134 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ **The API is likely to change a few times before we reach 1.0.0** -Please read all the README, you may find it very useful. And do not forget to peek into the [CHANGELOG](https://github.com/cucumber/godog/blob/master/CHANGELOG.md) from time to time. +Please read the full README, you may find it very useful. And do not forget to peek into the [Release Notes](https://github.com/cucumber/godog/blob/master/release-notes) and the [CHANGELOG](https://github.com/cucumber/godog/blob/master/CHANGELOG.md) from time to time. Package godog is the official Cucumber BDD framework for Golang, it merges specification and test documentation into one cohesive whole, using Gherkin formatted scenarios in the format of Given, When, Then. @@ -43,13 +43,13 @@ When automated testing is this much fun, teams can easily protect themselves fro ## Install ``` -go get github.com/cucumber/godog/cmd/godog@v0.9.0 +go get github.com/cucumber/godog/cmd/godog@v0.10.0-rc1 ``` -Adding `@v0.9.0` will install v0.9.0 specifically instead of master. +Adding `@v0.10.0-rc1` will install v0.10.0-rc1 specifically instead of master. Running `within the $GOPATH`, you would also need to set `GO111MODULE=on`, like this: ``` -GO111MODULE=on go get github.com/cucumber/godog/cmd/godog@v0.9.0 +GO111MODULE=on go get github.com/cucumber/godog/cmd/godog@v0.10.0-rc1 ``` ## Contributions @@ -140,7 +140,7 @@ package main import ( "fmt" - messages "github.com/cucumber/messages-go/v10" // needed for godog v0.9.0 (latest) and earlier + messages "github.com/cucumber/messages-go/v10" // needed for godog v0.9.0 and earlier "github.com/cucumber/godog" ) @@ -165,7 +165,7 @@ func thereShouldBeRemaining(remaining int) error { return nil } -// godog v0.9.0 (latest) and earlier +// godog v0.9.0 and earlier func FeatureContext(s *godog.Suite) { s.BeforeSuite(func() { Godogs = 0 }) @@ -178,7 +178,7 @@ func FeatureContext(s *godog.Suite) { s.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining) } -// godog v0.10.0 (coming release) +// godog v0.10.0-rc1 (latest) func InitializeTestSuite(ctx *godog.TestSuiteContext) { ctx.BeforeSuite(func() { Godogs = 0 }) } @@ -247,12 +247,12 @@ func TestMain(m *testing.M) { flag.Parse() opts.Paths = flag.Args() - // godog v0.9.0 (latest) and earlier + // godog v0.9.0 and earlier status := godog.RunWithOptions("godogs", func(s *godog.Suite) { FeatureContext(s) }, opts) - // godog v0.10.0 (coming release) + // godog v0.10.0-rc1 (latest) status := godog.TestSuite{ Name: "godogs", TestSuiteInitializer: InitializeTestSuite, @@ -284,12 +284,12 @@ func TestMain(m *testing.M) { Randomize: time.Now().UTC().UnixNano(), // randomize scenario execution order } - // godog v0.9.0 (latest) and earlier + // godog v0.9.0 and earlier status := godog.RunWithOptions("godogs", func(s *godog.Suite) { FeatureContext(s) }, opts) - // godog v0.10.0 (coming release) + // godog v0.10.0-rc1 (latest) status := godog.TestSuite{ Name: "godogs", TestSuiteInitializer: InitializeTestSuite, @@ -321,12 +321,12 @@ func TestMain(m *testing.M) { Paths: []string{"features"}, } - // godog v0.9.0 (latest) and earlier + // godog v0.9.0 and earlier status := godog.RunWithOptions("godogs", func(s *godog.Suite) { FeatureContext(s) }, opts) - // godog v0.10.0 (coming release) + // godog v0.10.0-rc1 (latest) status := godog.TestSuite{ Name: "godogs", TestSuiteInitializer: InitializeTestSuite, @@ -398,12 +398,12 @@ There are no global options or configuration files. Alias your common or project ### Concurrency +When concurrency is configured in options, godog will execute the scenarios concurrently, which is support by all supplied formatters. + In order to support concurrency well, you should reset the state and isolate each scenario. They should not share any state. It is suggested to run the suite concurrently in order to make sure there is no state corruption or race conditions in the application. It is also useful to randomize the order of scenario execution, which you can now do with **--random** command option. -**NOTE:** if suite runs with concurrency option, it concurrently runs every feature, not scenario per different features. This will be updated in release v0.10.0 to run every scenario concurrently. - ## License **Godog** and **Gherkin** are licensed under the [MIT][license] and developed as a part of the [cucumber project][cucumber] diff --git a/_examples/api/features/version.feature b/_examples/api/features/version.feature index 6fc4f2a..87334ef 100644 --- a/_examples/api/features/version.feature +++ b/_examples/api/features/version.feature @@ -20,6 +20,6 @@ Feature: get version And the response should match json: """ { - "version": "v0.9.0" + "version": "v0.10.0-rc1" } """ diff --git a/godog.go b/godog.go index fb8ec92..33ab03f 100644 --- a/godog.go +++ b/godog.go @@ -39,4 +39,4 @@ Godog was inspired by Behat and Cucumber the above description is taken from it' package godog // Version of package - based on Semantic Versioning 2.0.0 http://semver.org/ -const Version = "v0.9.0" +const Version = "v0.10.0-rc1" diff --git a/release-notes/v0.10.0.md b/release-notes/v0.10.0.md new file mode 100644 index 0000000..ad77cde --- /dev/null +++ b/release-notes/v0.10.0.md @@ -0,0 +1,115 @@ +I am excited to announce the release of godog v0.10.0. + +Here follows a summary of Notable Changes, the Non Backward Compatible Changes and Deprecation Notices. +The full change log is available [here](https://github.com/cucumber/godog/blob/master/CHANGELOG.md). + + +Notable Changes +--------------- + +### Context Initializers +The current Suite initializer will be removed and replaced by two new initializers, one for the Test Suite and one for the Scenarios. + +The **TestSuiteContext** Initializer will be executed once for the execution of the full TestSuite. +```go +// These are the hooks that can be configured for the TestSuite. +func (ctx *TestSuiteContext) BeforeSuite(fn func()) +func (ctx *TestSuiteContext) AfterSuite(fn func()) +``` + +The **ScenarioContext** Initializer will be executed before every Scenario. +```go +// These are the hooks that can be configured for a Scenario. +func (ctx *ScenarioContext) BeforeScenario(fn func(sc *Scenario)) +func (ctx *ScenarioContext) AfterScenario(fn func(sc *Scenario, err error)) +func (ctx *ScenarioContext) BeforeStep(fn func(st *Step)) +func (ctx *ScenarioContext) AfterStep(fn func(st *Step, err error)) + +// Registers a step definition for a Scenario. +func (ctx *ScenarioContext) Step(expr, stepFunc interface{}) +``` + +### Formatter Concurrency +All builtin formatters now support concurrency. + +### Scenario Concurrency +Using the new Initializers, godog will now execute scenarios concurrently instead of features. + + +Non Backward Compatible Changes +------------------------------- + +### Hooks +`BeforeFeature` and `AfterFeature` hooks are now removed since the deprecation in `v0.9.0`. + + +Deprecation Notices +------------------- + +### Run and RunWithOptions +`Run` and `RunWithOptions` are now considered deprecated and will be removed in `v0.11.0`. + +`godog.Run(suiteName string, initializer func(*Suite))` will be replaced by: +```go +godog.TestSuite{ + Name: suiteName, + TestSuiteInitializer: testSuiteInitializer, + ScenarioInitializer: scenarioInitializer, +}.Run() +``` + +`godog.RunWithOptions(suiteName string, initializer func(*Suite), opts Options)` will be replaced by: +```go +godog.TestSuite{ + Name: suiteName, + TestSuiteInitializer: testSuiteInitializer, + ScenarioInitializer: scenarioInitializer, + Options: &opts, +}.Run() +``` + +### Suite Initializers +The `Suite` is now considered deprecated and will be removed in `v0.11.0`. + +Initializers that use `*godog.Suite` like this: +```go +func FeatureContext(s *godog.Suite) { + s.BeforeSuite(func() { Godogs = 0 }) + + s.BeforeScenario(func(*messages.Pickle) { + Godogs = 0 // clean the state before every scenario + }) + + s.Step(`^there are (\d+) godogs$`, thereAreGodogs) + s.Step(`^I eat (\d+)$`, iEat) + s.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining) +} +``` + +will be replaced by: +```go +func InitializeTestSuite(ctx *godog.TestSuiteContext) { + ctx.BeforeSuite(func() { Godogs = 0 }) +} + +func InitializeScenario(ctx *godog.ScenarioContext) { + ctx.BeforeScenario(func(*godog.Scenario) { + Godogs = 0 // clean the state before every scenario + }) + + ctx.Step(`^there are (\d+) godogs$`, thereAreGodogs) + ctx.Step(`^I eat (\d+)$`, iEat) + ctx.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining) +} +``` + +### SuiteContext +The `SuiteContext` is now considered deprecated and will be removed in `v0.11.0`. + +### Concurrency Formatter +The `ConcurrencyFormatter` interface is now considered deprecated and will be removed in `v0.11.0`. + +Full change log +--------------- + +See [CHANGELOG.md](https://github.com/cucumber/godog/blob/master/CHANGELOG.md). \ No newline at end of file