Skip to content

Commit ad7feb3

Browse files
authored
Add release notes and bump version (cucumber#416)
1 parent 8cf3f41 commit ad7feb3

File tree

4 files changed

+146
-7
lines changed

4 files changed

+146
-7
lines changed

CHANGELOG.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
88

99
---
1010

11-
## [Unreleased]
11+
## [v0.12.0]
1212

1313
### Added
1414

1515
- Support for step definitions without return ([364](https://github.com/cucumber/godog/pull/364) - [titouanfreville])
1616
- Contextualized hooks for scenarios and steps ([409](https://github.com/cucumber/godog/pull/409)) - [vearutop])
1717
- Step result status in After hook ([409](https://github.com/cucumber/godog/pull/409)) - [vearutop])
18+
- Support auto converting doc strings to plain strings ([380](https://github.com/cucumber/godog/pull/380)) - [chirino])
19+
- Use multiple formatters in the same test run ([392](https://github.com/cucumber/godog/pull/392)) - [vearutop])
20+
- Added `RetrieveFeatures()` method to `godog.TestSuite` ([276](https://github.com/cucumber/godog/pull/276)) - [radtriste])
1821

1922
### Changed
2023

21-
- Upgraded gherkin-go to v19 ([402](https://github.com/cucumber/godog/pull/402) - [mbow])
24+
- Upgraded gherkin-go to v19 and messages-go to v16 ([402](https://github.com/cucumber/godog/pull/402) - [mbow])
25+
- Generate simpler snippets that use *godog.DocString and *godog.Table ([379](https://github.com/cucumber/godog/pull/379)) - [chirino])
2226

2327
### Deprecated
2428

@@ -207,3 +211,6 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
207211
[rickardenglund]: https://github.com/rickardenglund
208212
[mbow]: https://github.com/mbow
209213
[vearutop]: https://github.com/vearutop
214+
[chirino]: https://github.com/chirino
215+
[radtriste]: https://github.com/radtriste
216+
[karfrank]: https://github.com/karfrank

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ When automated testing is this much fun, teams can easily protect themselves fro
4545

4646
## Install
4747
```
48-
go get github.com/cucumber/godog/cmd/godog@v0.11.0
48+
go get github.com/cucumber/godog/cmd/godog@v0.12.0
4949
```
50-
Adding `@v0.11.0` will install v0.11.0 specifically instead of master.
50+
Adding `@v0.12.0` will install v0.12.0 specifically instead of master.
5151

5252
Running `within the $GOPATH`, you would also need to set `GO111MODULE=on`, like this:
5353
```
54-
GO111MODULE=on go get github.com/cucumber/godog/cmd/godog@v0.11.0
54+
GO111MODULE=on go get github.com/cucumber/godog/cmd/godog@v0.12.0
5555
```
5656

5757
## Contributions
@@ -390,7 +390,7 @@ import (
390390

391391
"github.com/cucumber/godog"
392392
"github.com/cucumber/godog/colors"
393-
"github.com/spf13/pflag" // godog v0.11.0 (latest)
393+
"github.com/spf13/pflag" // godog v0.11.0 and later
394394
)
395395

396396
var opts = godog.Options{

godog.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ Godog was inspired by Behat and Cucumber the above description is taken from it'
3939
package godog
4040

4141
// Version of package - based on Semantic Versioning 2.0.0 http://semver.org/
42-
const Version = "v0.11.0"
42+
const Version = "v0.12.0"

release-notes/v0.12.0.md

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
We are excited to announce the release of godog v0.12.0.
2+
3+
Here follows a summary of Notable Changes, the Non Backward Compatible Changes and Deprecation Notices. The full change
4+
log is available [here](https://github.com/cucumber/godog/blob/master/CHANGELOG.md).
5+
6+
7+
Notable Changes
8+
---------------
9+
10+
### Output with multiple formatters
11+
12+
Now `godog` is able to use multiple formatters simultaneously with comma-separated formatters.
13+
14+
`--format pretty,junit:report.xml,cucumber:report.json` will write `pretty` format to stdout, `junit` to report.xml
15+
and `cucumber` to report.json.
16+
17+
### Contextualized hooks
18+
19+
Scenario and Step hooks are now passing context to allow custom state communication. Returned context should generally
20+
be based or equal to received context. Context is also passed to steps that have it in declaration and is read from
21+
steps that return it.
22+
23+
Hooks can now return error, if non nil error is returned test is failed. This enables additional flow control, for
24+
example to check expectations after the scenario.
25+
26+
Scenario hooks are now named `Before` and `After`.
27+
28+
```go
29+
// BeforeScenarioHook defines a hook before scenario.
30+
type BeforeScenarioHook func (ctx context.Context, sc *Scenario) (context.Context, error)
31+
32+
// AfterScenarioHook defines a hook after scenario.
33+
type AfterScenarioHook func (ctx context.Context, sc *Scenario, err error) (context.Context, error)
34+
```
35+
36+
Step hooks are now also named `Before` and `After`, but they are available with `ScenarioContext.StepContext()`.
37+
38+
```go
39+
// BeforeStepHook defines a hook before step.
40+
type BeforeStepHook func (ctx context.Context, st *Step) (context.Context, error)
41+
42+
// AfterStepHook defines a hook after step.
43+
type AfterStepHook func (ctx context.Context, st *Step, status StepResultStatus, err error) (context.Context, error)
44+
```
45+
46+
### Step definition improvements
47+
48+
Now `godog` can use additional ways to declare step definition. These declarations are optional and do not break
49+
backwards compatibility.
50+
51+
Error result may be omitted if the step does not fail.
52+
53+
```go
54+
func iEat(arg1 int) {
55+
// Eat arg1.
56+
}
57+
```
58+
59+
You can have `context.Context` as first argument, test runner will pass current context to the step.
60+
61+
```go
62+
func iEat(ctx context.Context, arg1 int) {
63+
if v, ok := ctx.Value(eatKey{}).int; ok {
64+
// Eat v from context.
65+
}
66+
// Eat arg1.
67+
}
68+
```
69+
70+
You can have `context.Context` in return, test runner will use returned context to pass to next hooks and steps.
71+
72+
```go
73+
func iEat(ctx context.Context, arg1 int) context.Context {
74+
if v, ok := ctx.Value(eatKey{}).int; ok {
75+
// Eat v from context.
76+
}
77+
// Eat arg1.
78+
79+
return context.WithValue(ctx, eatKey{}, 0)
80+
}
81+
```
82+
83+
If error is also needed in return, context have to be first.
84+
85+
```go
86+
func iEat(ctx context.Context, arg1 int) (context.Context, error) {
87+
if v, ok := ctx.Value(eatKey{}).int; ok {
88+
// Eat v from context.
89+
}
90+
// Eat arg1.
91+
92+
if arg1 == 0 {
93+
return errors.New("can't eat nothing")
94+
}
95+
96+
return context.WithValue(ctx, eatKey{}, 0), nil
97+
}
98+
```
99+
100+
You can now use `string` instead of `*godog.DocString` in declaration.
101+
102+
### Getting features of test suite
103+
104+
`godog.TestSuite` now can `RetrieveFeatures() ([]*models.Feature, error)` to expose parsed features to the user.
105+
106+
### Added official support for go1.16
107+
108+
With the introduction of go1.16, go1.16 is now officially supported.
109+
110+
Non Backward Compatible Changes
111+
-------------------------------
112+
113+
### Messages library updated
114+
115+
Messages library is changed from `github.com/cucumber/messages-go/v10` to `github.com/cucumber/messages-go/v16`.
116+
117+
Deprecation Notices
118+
-------------------
119+
120+
### Hooks
121+
122+
Scenario and step hooks were upgraded with new API to support context and errors, previous methods are now deprecated.
123+
124+
- `ScenarioContext.BeforeScenario`, use `ScenarioContext.Before`
125+
- `ScenarioContext.AfterScenario`, use `ScenarioContext.After`
126+
- `ScenarioContext.BeforeStep`, use `ScenarioContext.StepContext().Before`
127+
- `ScenarioContext.AfterStep`, use `ScenarioContext.StepContext().After`
128+
129+
Full change log
130+
---------------
131+
132+
See [CHANGELOG.md](https://github.com/cucumber/godog/blob/master/CHANGELOG.md).

0 commit comments

Comments
 (0)