Skip to content

Releases: cucumber/godog

v0.12.0

17 Aug 09:34
afaebf2
Compare
Choose a tag to compare

We are excited to announce the release of godog v0.12.0.

Here follows a summary of Notable Changes, the Non Backward Compatible Changes and Deprecation Notices. The full change
log is available here.

Notable Changes

Output with multiple formatters

Now godog is able to use multiple formatters simultaneously with comma-separated formatters.

--format pretty,junit:report.xml,cucumber:report.json will write pretty format to stdout, junit to report.xml
and cucumber to report.json.

Extensible formatters

Standard formatters are now exported with type aliases so that a custom formatter can be built on top of it.
Please check an example.

Contextualized hooks

Scenario and Step hooks are now passing context to allow custom state communication. Returned context should generally
be based or equal to received context. Context is also passed to steps that have it in declaration and is read from
steps that return it.

Hooks can now return error, if non nil error is returned test is failed. This enables additional flow control, for
example to check expectations after the scenario.

Scenario hooks are now named Before and After.

// BeforeScenarioHook defines a hook before scenario.
type BeforeScenarioHook func (ctx context.Context, sc *Scenario) (context.Context, error)

// AfterScenarioHook defines a hook after scenario.
type AfterScenarioHook func (ctx context.Context, sc *Scenario, err error) (context.Context, error)

Step hooks are now also named Before and After, but they are available with ScenarioContext.StepContext().

// BeforeStepHook defines a hook before step.
type BeforeStepHook func (ctx context.Context, st *Step) (context.Context, error)

// AfterStepHook defines a hook after step.
type AfterStepHook func (ctx context.Context, st *Step, status StepResultStatus, err error) (context.Context, error)

Step definition improvements

Now godog can use additional ways to declare step definition. These declarations are optional and do not break
backwards compatibility.

Error result may be omitted if the step does not fail.

func iEat(arg1 int) {
    // Eat arg1.
}

You can have context.Context as first argument, test runner will pass current context to the step.

func iEat(ctx context.Context, arg1 int) {
    if v, ok := ctx.Value(eatKey{}).int; ok {
        // Eat v from context.
    }
    // Eat arg1.
}

You can have context.Context in return, test runner will use returned context to pass to next hooks and steps.

func iEat(ctx context.Context, arg1 int) context.Context {
    if v, ok := ctx.Value(eatKey{}).int; ok {
        // Eat v from context.
    }
    // Eat arg1.
    
    return context.WithValue(ctx, eatKey{}, 0)
}

If error is also needed in return, context have to be first.

func iEat(ctx context.Context, arg1 int) (context.Context, error) {
    if v, ok := ctx.Value(eatKey{}).int; ok {
        // Eat v from context.
    }
    // Eat arg1.

    if arg1 == 0 {
        return errors.New("can't eat nothing")
    }
    
    return context.WithValue(ctx, eatKey{}, 0), nil
}

You can now use string instead of *godog.DocString in declaration.

Getting features of test suite

godog.TestSuite now can RetrieveFeatures() ([]*models.Feature, error) to expose parsed features to the user.

Added official support for go1.16 and go1.17

With the introduction of go1.17, go1.17 and go1.16 are now officially supported.

Running scenarios as subtests of *testing.T

You can now assign an instance of *testing.T to godog.Options.TestingT so that scenarios will be invoked with
t.Run allowing granular control with standard Go tools.

More info.

Non Backward Compatible Changes

Messages library updated

Messages library is changed from github.com/cucumber/messages-go/v10 to github.com/cucumber/messages-go/v16.

Deprecation Notices

Hooks

Scenario and step hooks were upgraded with new API to support context and errors, previous methods are now deprecated.

  • ScenarioContext.BeforeScenario, use ScenarioContext.Before
  • ScenarioContext.AfterScenario, use ScenarioContext.After
  • ScenarioContext.BeforeStep, use ScenarioContext.StepContext().Before
  • ScenarioContext.AfterStep, use ScenarioContext.StepContext().After

Full change log

See CHANGELOG.md.

v0.12.0-rc2

12 Aug 08:11
6173029
Compare
Choose a tag to compare
Add option to run scenarios as *testing.T subtests (#419)

v0.12.0-rc1

09 Aug 08:21
ad7feb3
Compare
Choose a tag to compare
Add release notes and bump version (#416)

v0.11.0

12 Jan 19:21
Compare
Choose a tag to compare

This release includes some bugfixes and internal restructure of the codebase, but most notably;

  • godog now supports writing output to a file with --format cucumber:report.json.
  • godog now supports sub commands like godog run and godog build.

More information can be found in the Changelog and Release Notes.

v0.10.0

25 Jun 07:02
Compare
Choose a tag to compare

This release includes a lot of smaller bugfixes, but most notably, we now have concurrency support for all our formatters and we now also support concurrency across scenarios.

More information can be found in the Changelog and Release Notes.

v0.9.0

23 Mar 10:07
0180f93
Compare
Choose a tag to compare

This release includes some minor bug fixes and most importantly, the gherkin core is now changed to gherkin-go.

More information can be found in the Changelog and Release Notes.

Minor changes to package def and for go mod purposes

10 Feb 18:02
58d12bc
Compare
Choose a tag to compare

It's possible that the 0.8.0 release I did wasn't done quite right, so bumping the patch version to see if that helps. This will also include some changes to ignore the examples from being included

Migration to /cucumber and setup CircleCI

06 Feb 16:14
Compare
Choose a tag to compare

This release gets godog using the codebase found here, under the Cucumber org. Additionally, it addresses #208 with setting up tests on CircleCI, the first passing run can be found here

Welcome to the Cucumber family, godog!

fixes the broken godog command in case of vendored dependency

15 Mar 15:01
8e7bc15
Compare
Choose a tag to compare
v0.7.13

compiler needs to link vendored packages

maintenance release

15 Mar 08:11
a69e4c6
Compare
Choose a tag to compare
  1. adds table output to cucumber json report
  2. fixes the build with module when there is no godog import in any source file