Ginkgo: BDD testing in Golang

Ginkgo is a BDD-style Go testing framework built to help you efficiently write expressive and comprehensive tests. It is best paired with the Gomega matcher library but is designed to be matcher-agnostic.

Feature List

  • Ginkgo uses Go’s testing package and can live alongside your existing testing tests. It’s easy to bootstrap and start writing your first tests
  • Structure your BDD-style tests expressively:
  • A comprehensive test runner that lets you:
    • Mark specs as pending
    • Focus individual specs, and groups of specs, either programmatically or on the command line
    • Run your tests in random order, and then reuse random seeds to replicate the same order.
    • Break up your test suite into parallel processes for straightforward test parallelization
  • ginkgo: a command line interface with plenty of handy command line arguments for running your tests and generating test files. Here are a few choice examples:
    • ginkgo -nodes=N runs your tests in N parallel processes and print out coherent output in realtime
    • ginkgo -cover runs your tests using Go’s code coverage tool
    • ginkgo convert converts an XUnit-style testing package to a Ginkgo-style package
    • ginkgo -focus="REGEXP" and ginkgo -skip="REGEXP" allow you to specify a subset of tests to run via regular expression
    • ginkgo -r runs all tests suites under the current directory
    • ginkgo -v prints out identifying information for each tests just before it runs
    And much more: run ginkgo help for details!The ginkgo CLI is convenient, but purely optional — Ginkgo works just fine with go test
  • ginkgo watch watches packages and their dependencies for changes, then reruns tests. Run tests immediately as you develop!
  • Built-in support for testing asynchronicity
  • Built-in support for benchmarking your code. Control the number of benchmark samples as you gather runtimes and other, arbitrary, bits of numerical information about your code.
  • Completions for Sublime Text: just use Package Control to install Ginkgo Completions.
  • Completions for VSCode: just use VSCode’s extension installer to install vscode-ginkgo.
  • Straightforward support for third-party testing libraries such as Gomock and Testify. Check out the docs for details.
  • A modular architecture that lets you easily: