API Reference

Ginkgo

A BDD testing framework for Go with a descriptive DSL and parallel test execution.

Official Documentation ↗
CompatibilityThis documentation covers version v2.17. Check the official docs for the latest API surface.

Installation

gogo get github.com/onsi/ginkgo/v2

Methods

Ginkgo structures specs with Describe and It and runs them through a generated suite bootstrap.

Key Features

  • Descriptive spec DSL
  • Ordered and parallel execution
  • Rich failure output and reporters

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://onsi.github.io/ginkgo/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:48.838Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

  • There is, however, one exception to this rule: a package ending in _test is allowed to live in the same directory as the package being tested. (https://onsi.github.io/ginkgo/)
  • One quick note before we move on, you may have caught that book.HumanReadableWeight() returns two values - a weight string and an error . (https://onsi.github.io/ginkgo/)
  • This elegantly inlines error handling and can make your specs more readable. (https://onsi.github.io/ginkgo/)

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://onsi.github.io/ginkgo/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:48.838Z.

  • You can disable XProtect for your terminal by running: spctl developer-mode enable-terminal and then opening up System Settings > Privacy & Security > Developer Tools and then adding your terminal to the list of developer tools. (https://onsi.github.io/ginkgo/)

FAQ

How do I run specs in parallel?
Run ginkgo -p or set the parallel flag; each spec runs in an isolated process, so avoid shared external state.
How do I skip a spec?
Prefix with XIt or PIt to skip, or use Skip with a reason; ginkgo reports pending specs separately.
How does it integrate with go test?
Ginkgo suites run through go test via the generated bootstrap, so standard tooling and coverage still apply.