• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..04-Jan-2017-

config/H04-Jan-2017-171124

ginkgo/H04-Jan-2017-3,9483,012

integration/H04-Jan-2017-1,9231,553

internal/H04-Jan-2017-7,7446,324

reporters/H04-Jan-2017-1,9861,649

types/H04-Jan-2017-283222

.gitignoreH A D04-Jan-201738 44

.travis.ymlH A D04-Jan-2017310 1310

CHANGELOG.mdH A D04-Jan-20175.8 KiB11280

LICENSEH A D04-Jan-20171 KiB2117

README.mdH A D04-Jan-20176.7 KiB11670

ginkgo_dsl.goH A D04-Jan-201719.8 KiB522265

README.md

1![Ginkgo: A Golang BDD Testing Framework](http://onsi.github.io/ginkgo/images/ginkgo.png)
2
3[![Build Status](https://travis-ci.org/onsi/ginkgo.png)](https://travis-ci.org/onsi/ginkgo)
4
5Jump to the [docs](http://onsi.github.io/ginkgo/) to learn more.  To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)!
6
7To discuss Ginkgo and get updates, join the [google group](https://groups.google.com/d/forum/ginkgo-and-gomega).
8
9## Feature List
10
11- Ginkgo uses Go's `testing` package and can live alongside your existing `testing` tests.  It's easy to [bootstrap](http://onsi.github.io/ginkgo/#bootstrapping-a-suite) and start writing your [first tests](http://onsi.github.io/ginkgo/#adding-specs-to-a-suite)
12
13- Structure your BDD-style tests expressively:
14    - Nestable [`Describe` and `Context` container blocks](http://onsi.github.io/ginkgo/#organizing-specs-with-containers-describe-and-context)
15    - [`BeforeEach` and `AfterEach` blocks](http://onsi.github.io/ginkgo/#extracting-common-setup-beforeeach) for setup and teardown
16    - [`It` blocks](http://onsi.github.io/ginkgo/#individual-specs-) that hold your assertions
17    - [`JustBeforeEach` blocks](http://onsi.github.io/ginkgo/#separating-creation-and-configuration-justbeforeeach) that separate creation from configuration (also known as the subject action pattern).
18    - [`BeforeSuite` and `AfterSuite` blocks](http://onsi.github.io/ginkgo/#global-setup-and-teardown-beforesuite-and-aftersuite) to prep for and cleanup after a suite.
19
20- A comprehensive test runner that lets you:
21    - Mark specs as [pending](http://onsi.github.io/ginkgo/#pending-specs)
22    - [Focus](http://onsi.github.io/ginkgo/#focused-specs) individual specs, and groups of specs, either programmatically or on the command line
23    - Run your tests in [random order](http://onsi.github.io/ginkgo/#spec-permutation), and then reuse random seeds to replicate the same order.
24    - Break up your test suite into parallel processes for straightforward [test parallelization](http://onsi.github.io/ginkgo/#parallel-specs)
25
26- `ginkgo`: a command line interface with plenty of handy command line arguments for [running your tests](http://onsi.github.io/ginkgo/#running-tests) and [generating](http://onsi.github.io/ginkgo/#generators) test files.  Here are a few choice examples:
27    - `ginkgo -nodes=N` runs your tests in `N` parallel processes and print out coherent output in realtime
28    - `ginkgo -cover` runs your tests using Golang's code coverage tool
29    - `ginkgo convert` converts an XUnit-style `testing` package to a Ginkgo-style package
30    - `ginkgo -focus="REGEXP"` and `ginkgo -skip="REGEXP"` allow you to specify a subset of tests to run via regular expression
31    - `ginkgo -r` runs all tests suites under the current directory
32    - `ginkgo -v` prints out identifying information for each tests just before it runs
33
34    And much more: run `ginkgo help` for details!
35
36    The `ginkgo` CLI is convenient, but purely optional -- Ginkgo works just fine with `go test`
37
38- `ginkgo watch` [watches](https://onsi.github.io/ginkgo/#watching-for-changes) packages *and their dependencies* for changes, then reruns tests.  Run tests immediately as you develop!
39
40- Built-in support for testing [asynchronicity](http://onsi.github.io/ginkgo/#asynchronous-tests)
41
42- Built-in support for [benchmarking](http://onsi.github.io/ginkgo/#benchmark-tests) your code.  Control the number of benchmark samples as you gather runtimes and other, arbitrary, bits of numerical information about your code.
43
44- [Completions for Sublime Text](https://github.com/onsi/ginkgo-sublime-completions): just use [Package Control](https://sublime.wbond.net/) to install `Ginkgo Completions`.
45
46- Straightforward support for third-party testing libraries such as [Gomock](https://code.google.com/p/gomock/) and [Testify](https://github.com/stretchr/testify).  Check out the [docs](http://onsi.github.io/ginkgo/#third-party-integrations) for details.
47
48- A modular architecture that lets you easily:
49    - Write [custom reporters](http://onsi.github.io/ginkgo/#writing-custom-reporters) (for example, Ginkgo comes with a [JUnit XML reporter](http://onsi.github.io/ginkgo/#generating-junit-xml-output) and a TeamCity reporter).
50    - [Adapt an existing matcher library (or write your own!)](http://onsi.github.io/ginkgo/#using-other-matcher-libraries) to work with Ginkgo
51
52## [Gomega](http://github.com/onsi/gomega): Ginkgo's Preferred Matcher Library
53
54Ginkgo is best paired with Gomega.  Learn more about Gomega [here](http://onsi.github.io/gomega/)
55
56## [Agouti](http://github.com/sclevine/agouti): A Golang Acceptance Testing Framework
57
58Agouti allows you run WebDriver integration tests.  Learn more about Agouti [here](http://agouti.org)
59
60## Set Me Up!
61
62You'll need Golang v1.2+ (Ubuntu users: you probably have Golang v1.0 -- you'll need to upgrade!)
63
64```bash
65
66go get github.com/onsi/ginkgo/ginkgo  # installs the ginkgo CLI
67go get github.com/onsi/gomega         # fetches the matcher library
68
69cd path/to/package/you/want/to/test
70
71ginkgo bootstrap # set up a new ginkgo suite
72ginkgo generate  # will create a sample test file.  edit this file and add your tests then...
73
74go test # to run your tests
75
76ginkgo  # also runs your tests
77
78```
79
80## I'm new to Go: What are my testing options?
81
82Of course, I heartily recommend [Ginkgo](https://github.com/onsi/ginkgo) and [Gomega](https://github.com/onsi/gomega).  Both packages are seeing heavy, daily, production use on a number of projects and boast a mature and comprehensive feature-set.
83
84With that said, it's great to know what your options are :)
85
86### What Golang gives you out of the box
87
88Testing is a first class citizen in Golang, however Go's built-in testing primitives are somewhat limited: The [testing](http://golang.org/pkg/testing) package provides basic XUnit style tests and no assertion library.
89
90### Matcher libraries for Golang's XUnit style tests
91
92A number of matcher libraries have been written to augment Go's built-in XUnit style tests.  Here are two that have gained traction:
93
94- [testify](https://github.com/stretchr/testify)
95- [gocheck](http://labix.org/gocheck)
96
97You can also use Ginkgo's matcher library [Gomega](https://github.com/onsi/gomega) in [XUnit style tests](http://onsi.github.io/gomega/#using-gomega-with-golangs-xunitstyle-tests)
98
99### BDD style testing frameworks
100
101There are a handful of BDD-style testing frameworks written for Golang.  Here are a few:
102
103- [Ginkgo](https://github.com/onsi/ginkgo) ;)
104- [GoConvey](https://github.com/smartystreets/goconvey)
105- [Goblin](https://github.com/franela/goblin)
106- [Mao](https://github.com/azer/mao)
107- [Zen](https://github.com/pranavraja/zen)
108
109Finally, @shageman has [put together](https://github.com/shageman/gotestit) a comprehensive comparison of golang testing libraries.
110
111Go explore!
112
113## License
114
115Ginkgo is MIT-Licensed
116