An implementation of Cucumber BDD-style testing for Go.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
gherkin Split newlines safely for Windows Jun 9, 2015
internal/features/basic Rewrite imports Jul 15, 2016
.travis.yml Add .travis.yml Mar 28, 2015
LICENSE.txt Rename package to gucumber Mar 23, 2015
builder.go Generate correct import path on Windows Jan 27, 2018
builder_test.go Adding support for composite GOPATHs Mar 21, 2017
runner.go Introducing failures summary Jan 2, 2018
stepdef_test.go Rewrite imports Jul 15, 2016


GoDoc Build Status MIT License

An implementation of Cucumber BDD-style testing for Go.


$ go get


Cucumber tests are made up of plain text ".feature" files and program source "step definitions", which for Gucumber are written in Go.


Put feature files internal/features/ with whatever organization you prefer. For example, you might create internal/features/accounts/login.feature with the following text:

Feature: Login Support

  Scenario: User successfully logs in
    Given I have user/pass "foo" / "bar"
    And they log into the website with user "foo" and password "bar"
    Then the user should be successfully logged in

Step Definitions

Create step definitions to match each step in your feature files. These go in ".go" files in the same internal/features/ directory. We might create internal/features/accounts/step_definitions.go:

package accounts

import (
	. ""

func init() {
	user, pass := "", ""

	Before("@login", func() {
		// runs before every feature or scenario tagged with @login

	Given(`^I have user/pass "(.+?)" / "(.+?)"$`, func(u, p string) {
		user, pass = u, p

	// ...

	Then(`^the user should be successfully logged in$`, func() {
		if !userIsLoggedIn() {
			T.Errorf("user should have been logged in")


The T value is a testing.T style value that represents the test context for each test. It mostly supports Errorf(fmt, args...), but also supports other convenience methods. See the API documentation for more information.


To run your tests, execute:

$ gucumber

You can also specify the path to features in command line arguments:

$ gucumber path/to/features

You can also filter features and scenarios by tags:

$ gucumber -tags=@login # only run login feature(s)


$ gucumber -tags=~@slow # ignore all "slow" scenarios


This library was written by Loren Segal in 2015. It is licensed for use under the MIT license.