Cucumber for golang

Overview

CircleCI PkgGoDev codecov

Godog

Godog logo

The API is likely to change a few times before we reach 1.0.0

Please read the full README, you may find it very useful. And do not forget to peek into the Release Notes and the CHANGELOG 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.

Godog does not intervene with the standard go test command behavior. You can leverage both frameworks to functionally test your application while maintaining all test related source code in _test.go files.

Godog acts similar compared to go test command, by using go compiler and linker tool in order to produce test executable. Godog contexts need to be exported the same way as Test functions for go tests. Note, that if you use godog command tool, it will use go executable to determine compiler and linker.

The project was inspired by behat and cucumber.

Why Godog/Cucumber

A single source of truth

Godog merges specification and test documentation into one cohesive whole.

Living documentation

Because they're automatically tested by Godog, your specifications are always bang up-to-date.

Focus on the customer

Business and IT don't always understand each other. Godog's executable specifications encourage closer collaboration, helping teams keep the business goal in mind at all times.

Less rework

When automated testing is this much fun, teams can easily protect themselves from costly regressions.

Read more

Install

go get github.com/cucumber/godog/cmd/[email protected]

Adding @v0.11.0 will install v0.11.0 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/[email protected]

Contributions

Godog is a community driven Open Source Project within the Cucumber organization, it is maintained by a handfull of developers, but we appreciate contributions from everyone.

If you are interested in developing Godog, we suggest you to visit one of our slack channels.

Feel free to open a pull request. Note, if you wish to contribute larger changes or an extension to the exported methods or types, please open an issue before and visit us in slack to discuss the changes.

Reach out to the community on our Cucumber Slack Community. Join here.

Popular Cucumber Slack channels for Godog:

Examples

You can find a few examples here.

Note that if you want to execute any of the examples and have the Git repository checked out in the $GOPATH, you need to use: GO111MODULE=off. Issue for reference.

Godogs

The following example can be found here.

Step 1 - Setup a go module

Given we create a new go module godogs in your normal go workspace. - mkdir godogs

From now on, this is our work directory - cd godogs

Initiate the go module - go mod init godogs

Step 2 - Install godog

Install the godog binary - go get github.com/cucumber/godog/cmd/godog

Step 3 - Create gherkin feature

Imagine we have a godog cart to serve godogs for lunch.

First of all, we describe our feature in plain text - vim features/godogs.feature

Feature: eat godogs
  In order to be happy
  As a hungry gopher
  I need to be able to eat godogs

  Scenario: Eat 5 out of 12
    Given there are 12 godogs
    When I eat 5
    Then there should be 7 remaining

Step 4 - Create godog step definitions

NOTE: same as go test godog respects package level isolation. All your step definitions should be in your tested package root directory. In this case: godogs.

If we run godog inside the module: - godog

You should see that the steps are undefined:

Feature: eat godogs
  In order to be happy
  As a hungry gopher
  I need to be able to eat godogs

  Scenario: Eat 5 out of 12          # features/godogs.feature:6
    Given there are 12 godogs
    When I eat 5
    Then there should be 7 remaining

1 scenarios (1 undefined)
3 steps (3 undefined)
220.129µs

You can implement step definitions for undefined steps with these snippets:

func iEat(arg1 int) error {
        return godog.ErrPending
}

func thereAreGodogs(arg1 int) error {
        return godog.ErrPending
}

func thereShouldBeRemaining(arg1 int) error {
        return godog.ErrPending
}

func InitializeScenario(ctx *godog.ScenarioContext) {
        ctx.Step(`^I eat (\d+)$`, iEat)
        ctx.Step(`^there are (\d+) godogs$`, thereAreGodogs)
        ctx.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
}

Create and copy the step definitions into a new file - vim godogs_test.go

package main

import "github.com/cucumber/godog"

func iEat(arg1 int) error {
        return godog.ErrPending
}

func thereAreGodogs(arg1 int) error {
        return godog.ErrPending
}

func thereShouldBeRemaining(arg1 int) error {
        return godog.ErrPending
}

func InitializeScenario(ctx *godog.ScenarioContext) {
        ctx.Step(`^I eat (\d+)$`, iEat)
        ctx.Step(`^there are (\d+) godogs$`, thereAreGodogs)
        ctx.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
}

Our module should now look like this:

godogs
- features
  - godogs.feature
- go.mod
- go.sum
- godogs_test.go

Run godog again - godog

You should now see that the scenario is pending with one step pending and two steps skipped:

Feature: eat godogs
  In order to be happy
  As a hungry gopher
  I need to be able to eat godogs

  Scenario: Eat 5 out of 12          # features/godogs.feature:6
    Given there are 12 godogs        # godogs_test.go:10 -> thereAreGodogs
      TODO: write pending definition
    When I eat 5                     # godogs_test.go:6 -> iEat
    Then there should be 7 remaining # godogs_test.go:14 -> thereShouldBeRemaining

1 scenarios (1 pending)
3 steps (1 pending, 2 skipped)
282.123µs

You may change return godog.ErrPending to return nil in the three step definitions and the scenario will pass successfully.

Step 5 - Create the main program to test

We only need a number of godogs for now. Lets keep it simple.

Create and copy the code into a new file - vim godogs.go

package main

// Godogs available to eat
var Godogs int

func main() { /* usual main func */ }

Our module should now look like this:

godogs
- features
  - godogs.feature
- go.mod
- go.sum
- godogs.go
- godogs_test.go

Step 6 - Add some logic to the step defintions

Now lets implement our step definitions to test our feature requirements:

Replace the contents of godogs_test.go with the code below - vim godogs_test.go

package main

import (
	"fmt"

	"github.com/cucumber/godog"
)

func thereAreGodogs(available int) error {
	Godogs = available
	return nil
}

func iEat(num int) error {
	if Godogs < num {
		return fmt.Errorf("you cannot eat %d godogs, there are %d available", num, Godogs)
	}
	Godogs -= num
	return nil
}

func thereShouldBeRemaining(remaining int) error {
	if Godogs != remaining {
		return fmt.Errorf("expected %d godogs to be remaining, but there is %d", remaining, Godogs)
	}
	return nil
}

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

When you run godog again - godog

You should see a passing run:

Feature: eat godogs
  In order to be happy
  As a hungry gopher
  I need to be able to eat godogs

  Scenario: Eat 5 out of 12          # features/godogs.feature:6
    Given there are 12 godogs        # godogs_test.go:10 -> thereAreGodogs
    When I eat 5                     # godogs_test.go:14 -> iEat
    Then there should be 7 remaining # godogs_test.go:22 -> thereShouldBeRemaining

1 scenarios (1 passed)
3 steps (3 passed)
258.302µs

We have hooked to BeforeScenario event in order to reset the application state before each scenario. You may hook into more events, like AfterStep to print all state in case of an error. Or BeforeSuite to prepare a database.

By now, you should have figured out, how to use godog. Another advice is to make steps orthogonal, small and simple to read for a user. Whether the user is a dumb website user or an API developer, who may understand a little more technical context - it should target that user.

When steps are orthogonal and small, you can combine them just like you do with Unix tools. Look how to simplify or remove ones, which can be composed.

Code of Conduct

Everyone interacting in this codebase and issue tracker is expected to follow the Cucumber code of conduct.

References and Tutorials

Documentation

See pkg documentation for general API details. See Circle Config for supported go versions. See godog -h for general command options.

See implementation examples:

FAQ

Running Godog with go test

You may integrate running godog in your go test command. You can run it using go TestMain func available since go 1.4. In this case it is not necessary to have godog command installed. See the following examples.

The following example binds godog flags with specified prefix godog in order to prevent flag collisions.

package main

import (
	"flag" // godog v0.10.0 and earlier
	"os"
	"testing"

	"github.com/cucumber/godog"
	"github.com/cucumber/godog/colors"
	flag "github.com/spf13/pflag" // godog v0.11.0 (latest)
)

var opts = godog.Options{
	Output: colors.Colored(os.Stdout),
	Format: "progress", // can define default values
}

func init() {
	godog.BindFlags("godog.", flag.CommandLine, &opts) // godog v0.10.0 and earlier
	godog.BindCommandLineFlags("godog.", &opts)        // godog v0.11.0 (latest)
}

func TestMain(m *testing.M) {
	flag.Parse()
	opts.Paths = flag.Args()

	status := godog.TestSuite{
		Name: "godogs",
		TestSuiteInitializer: InitializeTestSuite,
		ScenarioInitializer:  InitializeScenario,
		Options: &opts,
	}.Run()

	// Optional: Run `testing` package's logic besides godog.
	if st := m.Run(); st > status {
		status = st
	}

	os.Exit(status)
}

Then you may run tests with by specifying flags in order to filter features.

go test -v --godog.random --godog.tags=wip
go test -v --godog.format=pretty --godog.random -race -coverprofile=coverage.txt -covermode=atomic

The following example does not bind godog flags, instead manually configuring needed options.

func TestMain(m *testing.M) {
	opts := godog.Options{
		Format:    "progress",
		Paths:     []string{"features"},
		Randomize: time.Now().UTC().UnixNano(), // randomize scenario execution order
	}

	status := godog.TestSuite{
		Name: "godogs",
		TestSuiteInitializer: InitializeTestSuite,
		ScenarioInitializer:  InitializeScenario,
		Options: &opts,
	}.Run()

	// Optional: Run `testing` package's logic besides godog.
	if st := m.Run(); st > status {
		status = st
	}

	os.Exit(status)
}

You can even go one step further and reuse go test flags, like verbose mode in order to switch godog format. See the following example:

func TestMain(m *testing.M) {
	format := "progress"
	for _, arg := range os.Args[1:] {
		if arg == "-test.v=true" { // go test transforms -v option
			format = "pretty"
			break
		}
	}

	opts := godog.Options{
		Format: format,
		Paths:     []string{"features"},
	}

	status := godog.TestSuite{
		Name: "godogs",
		TestSuiteInitializer: InitializeTestSuite,
		ScenarioInitializer:  InitializeScenario,
		Options: &opts,
	}.Run()

	// Optional: Run `testing` package's logic besides godog.
	if st := m.Run(); st > status {
		status = st
	}

	os.Exit(status)
}

Now when running go test -v it will use pretty format.

Tags

If you want to filter scenarios by tags, you can use the -t=<expression> or --tags=<expression> where <expression> is one of the following:

  • @wip - run all scenarios with wip tag
  • [email protected] - exclude all scenarios with wip tag
  • @wip && [email protected] - run wip scenarios, but exclude new
  • @wip,@undone - run wip or undone scenarios

Using assertion packages like testify with Godog

A more extensive example can be found here.

func thereShouldBeRemaining(remaining int) error {
	return assertExpectedAndActual(
		assert.Equal, Godogs, remaining,
		"Expected %d godogs to be remaining, but there is %d", remaining, Godogs,
	)
}

// assertExpectedAndActual is a helper function to allow the step function to call
// assertion functions where you want to compare an expected and an actual value.
func assertExpectedAndActual(a expectedAndActualAssertion, expected, actual interface{}, msgAndArgs ...interface{}) error {
	var t asserter
	a(&t, expected, actual, msgAndArgs...)
	return t.err
}

type expectedAndActualAssertion func(t assert.TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

// asserter is used to be able to retrieve the error reported by the called assertion
type asserter struct {
	err error
}

// Errorf is used by the called assertion to report an error
func (a *asserter) Errorf(format string, args ...interface{}) {
	a.err = fmt.Errorf(format, args...)
}

Configure common options for godog CLI

There are no global options or configuration files. Alias your common or project based commands: alias godog-wip="godog --format=progress [email protected]"

Testing browser interactions

godog does not come with builtin packages to connect to the browser. You may want to look at selenium and probably phantomjs. See also the following components:

  1. browsersteps - provides basic context steps to start selenium and navigate browser content.
  2. You may wish to have goquery in order to work with HTML responses like with JQuery.

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.

Building your own custom formatter

A simple example can be found here.

License

Godog and Gherkin are licensed under the MIT and developed as a part of the cucumber project

Comments
  • write output to a file

    write output to a file

    What do you think about adding output options for writing the output to a file?

    Something like this:

    godog \
    --random \
    --concurrency=5 \
    --format=progress \
    --output-file=junit.xml \
    --output-format=junit \
    features
    

    It would allow a user to see the progress status of the execution, but also write a junit formatted file.

    :zap: enhancement 
    opened by lonnblad 38
  • support vendoring

    support vendoring

    In a project using vendoring, I cannot use the vendored copy of godog.

    Steps to reproduce:

    • have a project in a single repostory with 3 directories: ** "foo" the package implementing things ** "features" where I have my *.feature files and step_test.go ** "vendor" where I vendored all my dependencies using govendor add '+all,^vendor,^local,^std' using https://github.com/kardianos/govendor (including "github.com/DATA-DOG/godog")
    • now remove godog package via rm -rf $GOPATHsrc/github.com/DATA-DOG/godog
    • trying to run godog ./features/*.features leads to
    # _/tmp/godog-1465317047292377579
    godog_runner_test.go:4:2: cannot find package "github.com/DATA-DOG/godog" in any of:
        /usr/local/go/src/github.com/DATA-DOG/godog (from $GOROOT)
        GOPATH/src/github.com/DATA-DOG/godog (from $GOPATH)
    FAIL    _/tmp/godog-1465317047292377579 [setup failed]
    

    It also doesn't work, when I go to the "features" directory and run godog *.features as well.

    opened by nightlyone 31
  • <fix>(PRETIFIER): fix s method

    (PRETIFIER): fix s method

    Context: While trying to create an helper library to manage http rest api testing, I made a system witch allow to pick value from responses, header, cookie, ... and inject then as variables. Issue: Doing this, when the inject variable make the line longer than the longest declared step, godog will failed to render test result under pretty formatting cause it will try to write a comment on a negative index Fix: Fix s methods so it will not goes to fatal when recieving negative number.

    opened by titouanfreville 25
  • Security error when getting v0.8.0 with go mod

    Security error when getting v0.8.0 with go mod

    Hello, I couldn't find the issue in the list so I open a new one. When trying to add github.com/cucumer/godog with go mod, it raise a security error regarding the checksum server

    go mod tidy             
    go: finding github.com/DATA-DOG/godog/gherkin latest
    go: downloading github.com/DATA-DOG/godog v0.8.0
    go: finding github.com/cucumber/godog/gherkin latest
    go: downloading github.com/cucumber/godog v0.8.0
    verifying github.com/cucumber/[email protected].8.0: checksum mismatch
            downloaded: h1:pwbfDlZsYqH55uKW35jLxhBzNYYGncYc9XLnGRfkVtk=
            sum.golang.org: h1:sJ0MaOGfNeJWD+DiBjL4VTwrUJrFdiq5sF5b4wPgS+o=
    
    SECURITY ERROR
    This download does NOT match the one reported by the checksum server.
    The bits may have been replaced on the origin server, or an attacker may
    have intercepted the download attempt.
    
    For more information, see 'go help module-auth'.
    

    I think you should be alerted on this :) Was using github.com/DATA-DOG/godog until now without any issue.

    opened by titouanfreville 19
  • failed to compile testmain package:

    failed to compile testmain package:

    I am getting a compilation error when running godog on example folder.

    Go version:

    $ go version
    go version go1.7.4 darwin/amd64
    

    I installed godog:

    $ go get -u github.com/DATA-DOG/godog
    

    Then I go into the godogs example directory:

    $ cd $GOPATH
    $ cd src/go/src/github.com/DATA-DOG/godog/examples/godogs
    

    And run godog:

    $ godog
    failed to compile testmain package:
    
    
    
    opened by RichardKnop 19
  • Switch from golint to staticcheck

    Switch from golint to staticcheck

    Description

    This PR switches static checking from the deprecated tool golint to staticcheck

    Motivation & context

    It switches static linting from a deprecated tool to a recommended one.

    Fixes #448

    Type of change

    • Refactoring/debt (improvement to code design or tooling without changing behaviour)

    Checklist:

    • [x] I have read the CONTRIBUTING document.
    • [ ] My change needed additional tests
      • [ ] I have added tests to cover my changes.
    • [x] My change requires a change to the documentation. (doesn't require a change, but I have changed CONTRIBUTING.md)
      • [x] I have updated the documentation accordingly. (to make it easier for future authors who update dependencies)
    • [ ] I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.
    :bank: debt 
    opened by carleeto 18
  • Update for 'messages-go v16' - WIP PR

    Update for 'messages-go v16' - WIP PR

    I am able to get a successful build but 'go test' is failing on 8 test cases, 7 of which are failing due to:

    • Error: runtime error: invalid memory address or nil pointer dereference

    I am unsure on how to resolve these issues, any help and would be appreciated.

    'go test' output attached: GoDog_test-results.txt

    opened by Yellaks 18
  • Adding context to steps

    Adding context to steps

    Is your feature request related to a problem? Please describe. We want to generate a library with some common steps. For example, a step that sends a REST request, a step that checks the status code, a step that validates the response, and a step that checks a HTTP header from the response. In this way, we could reuse some common steps. However, godog only passes the regex parameters as arguments. We could use a struct and create methods for that type. But we wouldn't get reusable steps in any scenario.

    Describe the solution you'd like I'd like that each scenario creates a context.Context instance (or custom context) and the context is passed as first argument in each step function. Instead of:

    func thereAreGodogs(available int) error {
    

    we would have:

    func thereAreGodogs(context.Context ctx, available int) error {
    

    Note that context.Context is immutable. So we would need to create a map to store all context changes related to godog, to return the context to chain the context for the next step, or to use a custom context type.

    Describe alternatives you've considered We could use InitializeScenario for this purpose but it would require a lot of repetitive code for each step:

    func InitializeScenario(ctx *godog.ScenarioContext) {
    	var stepCtx godog.Context
    	ctx.Step(`^there are (\d+) godogs$`, func(available int) {
    		thereAreGodogs(stepCtx, available)
    	})
    	...
    }
    

    Additional context See GoBDD that follows this approach. See also the motivations to write an alternative to Godog which I consider to be very good feedback for possible improvements in Godog.

    :zap: enhancement 
    opened by jlorgal 17
  • New maintainers wanted!

    New maintainers wanted!

    The creator of godog (@l3pp4rd) has stepped down as a maintainer and kindly donated the project to the cucumber GitHub organisation.

    We're looking for one or more new maintainers. The tasks are roughly:

    • Code! Scratch your own itch
    • Keep dependencies uptodate
    • Respond to GitHub issues/PRs in a timely manner
    • Keep the CHANGELOG uptodate
    • Make releases (Create git tags, update CHANGELOG)
    • Keep the documentation uptodate
    • Make the code habitable for new users and contributors
    • Keep the CI running

    If you are interested - comment on this issue!

    opened by aslakhellesoy 17
  • Color output broken on Windows cmd/ps with go v1.10.2

    Color output broken on Windows cmd/ps with go v1.10.2

    I've just upgraded go from 1.7.6 to 1.10.2 on Windows 7 machine and Godog's color output stopped to work:

        Running Integration test in: C:/Users/CDKQE/go/src/github.com/minishift/minishift/out/inte
        gration-test
        Using binary: C:/Users/CDKQE/minishift/minishift.exe
        ←[1;37mFeature: ←[0meap-cd add-on
          Eap-cd add-on imports eap-cd imagestreams and templates, which are then available in Ope
        nShift to the user.
         
        ←[1;37mFeature: ←[0mregistry-route add-on
          registry-route addon exposes the route for the OpenShift integrated registry,
          so that user can able to push their container images directly to registry and deploy it.
         
         
        ←[1;37mFeature: ←[0mxpaas add-on
          Xpaas add-on imports xPaaS templates and imagestreams,
          which are then available in OpenShift to the user.
         
        ←[1;37mFeature: ←[0mBasic
          As a user I can perform basic operations of Minishift and OpenShift
    

    With v1.7.6 everything was ok. Only solution now is to disable colors: --no-color.

    opened by agajdosi 15
  • Support rule keyword

    Support rule keyword

    Related to #440.

    After reading a bit more in the code I realized my original understanding of how it worked was wrong. Supporting Rule might not be that hard after all. I started implementing it a little. This is nowhere near finished though ...

    opened by michaelsauter 14
  • Implement unambiguous keywords

    Implement unambiguous keywords

    🤔 What's changed?

    • Updated gherkin-go to v24
    • Updated messages-go to v19
    • Introduced public functions Given(), When(), and Then() to test_context.go
    • Functions work identically to Step() but only match a feature step when their specific keyword is used

    ⚡️ What's your motivation?

    Resolves #479

    🏷️ What kind of change is this?

    • :zap: New feature (non-breaking change which adds new behaviour)

    📋 Checklist:

    • [x] I agree to respect and uphold the Cucumber Community Code of Conduct
    • [X] I've changed the behaviour of the code
      • [X] I have added/updated tests to cover my changes.
    • [X] My change requires a change to the documentation.
      • [X] I have updated the documentation accordingly.
    • [X] Users should know about my change
      • [x] I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

    This text was originally generated from a template, then edited by hand. You can modify the template here.

    opened by otrava7 6
  • Ability to define WHERE step definitions / features are located

    Ability to define WHERE step definitions / features are located

    🤔 What's the problem you're trying to solve?

    Attempt to centralize test code in one area, instead of all of the test code scattered across the entire project. I understand it's not necessarily idiomatic Go code, but it's more in line with how BDD test code is written in other languages.

    I'm frustrated when I'm trying to run a regression on my entire project, and I have to find individual files instead of being able to run and find all of my test code within one folder

    ✨ What's your proposed solution?

    Some way to specify where the source of the step definitions and feature files should be.

    This could be either a cli argument, or some sort of setting file, or even a field that can be set in the context struct.

    ⛏ Have you considered any alternatives or workarounds?

    When it comes to location of the files it seems diifficult to see any workaround that aren't being able to move the files.

    📚 Any additional context?

    For example, within the Java Cucumber support, you can define specifically where the features are located. The feature files themselves are able to map to step definitions anywhere in the project.

    image

    This text was originally generated from a template, then edited by hand. You can modify the template here.

    opened by sumusjack 1
  • GoDog with Playwright Go

    GoDog with Playwright Go

    🤔 What's the problem you're trying to solve?

    I would like to use GoDog with Playwright Go (since playwright has good framework for API and Browser automation). Please let us know if its possible to do this ! if, yes, if you could provide some examples that would be awesome.

    ✨ What's your proposed solution?

    integrate GoDog with Playwright Go (since playwright has good framework for API and Browser automation).

    ⛏ Have you considered any alternatives or workarounds?

    Right now using playwright with other programming languages such as typescript, python, java, c#

    📚 Any additional context?


    This text was originally generated from a template, then edited by hand. You can modify the template here.

    opened by PavanMudigondaTR 2
  • Retry failed tests automatically after the execution

    Retry failed tests automatically after the execution

    It would be really helpful if we have a feature to rerun the failed tests. It is common to fail one or other test when there are thousands of tests running in parallel. There can be multiple reasons for failure like network slowness, overloaded server. Rerun option is also provided by other tools for example ctest -> https://cmake.org/cmake/help/v3.17/manual/ctest.1.html ( --repeat until-pass:n ) maven-surefire-plugin -> https://maven.apache.org/surefire/maven-surefire-plugin/examples/rerun-failing-tests.html

    I have also seen recently in here https://github.com/cucumber-rs/cucumber/issues/212

    It would be really helpful, if you consider this. Thank you :)

    opened by harikamankala 0
  • godog returns wrong options(tags) values

    godog returns wrong options(tags) values

    👓 What did you see?

    When I want to read tag value at runtime using opts.tags the code returns values as "imeout" from last parameter -timeout when I remove -timout parameter(go test provides this parameter) tag values are returning correctly.

    ✅ What did you expect to see?

    The values should be returned as @abc && [email protected] && [email protected] && [email protected]"

    📦 Which tool/library version are you using?

    godog v0.12.5 go version 1.17.3

    🔬 How could we reproduce it?

    Steps to reproduce the behavior:

    1. Install versions given above
    2. Create a file called multiple feature files with a single common tag and tags specifying the scenarios e.g.(say @regression and @addition, @regression and @subtraction)
    3. Run command go test --godog.tags="@abc,@bcd && ~xyz" -v -timeout 60m
    4. see the value of tags printed

    📚 Any additional context?

    image


    opened by waytocypress 2
  • Run BeforeStep for multisteps

    Run BeforeStep for multisteps

    This PR will try to fix #486. Currently still work-in-progress.

    📋 Checklist:

    • [x] I agree to respect and uphold the Cucumber Community Code of Conduct
    • [ ] I've changed the behaviour of the code
      • [ ] I have added/updated tests to cover my changes.
    • [ ] My change requires a change to the documentation.
      • [ ] I have updated the documentation accordingly.
    • [ ] Users should know about my change
      • [ ] I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.
    opened by wichert 2
Releases(v0.12.5)
Owner
Cucumber
Cucumber Open
Cucumber
Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats.

Fortio Fortio (Φορτίο) started as, and is, Istio's load testing tool and now graduated to be its own project. Fortio is also used by, among others, Me

Fortio (Φορτίο) 2.7k Nov 17, 2022
Golang HTTP client testing framework

flute Golang HTTP client testing framework Presentation https://speakerdeck.com/szksh/flute-golang-http-client-testing-framework Overview flute is the

Shunsuke Suzuki 17 Sep 27, 2022
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Maxime Soulé 327 Nov 4, 2022
Testing API Handler written in Golang.

Gofight API Handler Testing for Golang Web framework. Support Framework Http Handler Golang package http provides HTTP client and server implementatio

Bo-Yi Wu 428 Nov 18, 2022
Sql mock driver for golang to test database interactions

Sql driver mock for Golang sqlmock is a mock library implementing sql/driver. Which has one and only purpose - to simulate any sql driver behavior in

DATA-DOG 4.8k Nov 19, 2022
Immutable transaction isolated sql driver for golang

Single transaction based sql.Driver for GO Package txdb is a single transaction based database sql driver. When the connection is opened, it starts a

DATA-DOG 494 Nov 21, 2022
HTTP mock for Golang: record and replay HTTP/HTTPS interactions for offline testing

govcr A Word Of Warning I'm in the process of partly rewriting govcr to offer better support for cassette mutations. This is necessary because when I

Seb C 137 Nov 18, 2022
HTTP mocking for Golang

httpmock Easy mocking of http responses from external resources. Install Currently supports Go 1.7 - 1.15. v1 branch has to be used instead of master.

Jared Morse 1.5k Nov 19, 2022
A test-friendly replacement for golang's time package

timex timex is a test-friendly replacement for the time package. Usage Just replace your time.Now() by a timex.Now() call, etc. Mocking Use timex.Over

Cabify 65 Sep 27, 2022
An implementation of failpoints for Golang.

failpoint An implementation of failpoints for Golang. Fail points are used to add code points where errors may be injected in a user controlled fashio

PingCAP 753 Nov 17, 2022
mockery - A mock code autogenerator for Golang

mockery - A mock code autogenerator for Golang

Vektra 4.1k Nov 22, 2022
Go (Golang) Fake Data Generator for Struct

Docs faker Struct Data Fake Generator Faker will generate you a fake data based on your Struct. Index Support Getting Started Example Limitation Contr

Iman Tumorang 2.1k Nov 25, 2022
Check your internet speed right from your terminal. Built on GOlang using chromedp

adhocore/fast A GO lang command line tool to check internet speed right from the terminal. Uses fast.com through headless chrome. Prerequistie Chrome

Jitendra Adhikari 70 Nov 16, 2022
A bytecode-based virtual machine to implement scripting/filtering support in your golang project.

eval-filter Implementation Scripting Facilities Types Built-In Functions Conditionals Loops Functions Case/Switch Use Cases Security Denial of service

Steve Kemp 90 Nov 15, 2022
Lightweight HTTP mocking in Go (aka golang)

httpmock This library builds on Go's built-in httptest library, adding a more mockable interface that can be used easily with other mocking tools like

null 78 Nov 2, 2022
WebDriverAgent ( iOS ) Client Library in Golang

appium/WebDriverAgent Client Library in Golang

雷系泡泡 259 Nov 24, 2022
Golang application focused on tests

Maceio Golang application that listens for webhook events coming from Github, runs tests previously defined in a configuration file and returns the ou

Leonardo Damasceno 5 Sep 8, 2021
A library to aid unittesting code that uses Golang's Github SDK

go-github-mock A library to aid unittesting code that uses Golang's Github SDK Installation go get github.com/migueleliasweb/go-github-mock Features C

Miguel Elias dos Santos 51 Nov 12, 2022
Simple Golang Load testing app built on top of vegeta

LOVE AND WAR : Give Your App Love By Unleashing War Simple load testing app to test your http services Installation Build docker image: docker build -

Raymond Gitonga 1 Oct 26, 2021