본문으로 건너뛰기
Skillpedia
테스트9.1k · #12303

overview

하는 일

이 스킬은 Go용 Ginkgo 테스트 도구가 어떻게 작동하는지 전체 그림을 보여 줍니다. Ginkgo 테스트 프로젝트를 시작하거나 테스트 작업을 계획하는 개발자를 위한 것입니다.

사용하는 경우

  • ✓Go 프로젝트에서 처음으로 Ginkgo 테스트를 시작할 때.
  • ✓Ginkgo 프로젝트에서 테스트 작업에 어떻게 접근할지 정해야 할 때.
  • ✓Ginkgo 테스트가 예상과 다르게 동작할 때.

스킬 링크

https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/overview/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/overview/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Go용 Ginkgo가 처음이에요. 시작하기 전에 테스트가 어떻게 구성되는지 설명해 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 Ginkgo가 먼저 모든 테스트의 목록을 만든 뒤 그것들을 실행한다고 설명하며, 특정 주제에 대해서는 같은 묶음의 다른 가이드를 가리킵니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Ginkgo: the mental model

Ginkgo is an expressive BDD-style testing framework for Go, paired with the Gomega matcher library. You build suites out of nested container nodes (Describe/Context/When) and subject nodes (It), with setup nodes (BeforeEach/AfterEach/…) supplying state. You drive it with the ginkgo CLI. Strongly prefer ginkgo over go test.

Read the canonical narrative docs at https://onsi.github.io/ginkgo/ — they are the source of truth. This skill is the orientation; the other skills go deep.

The one idea: tree construction, then running

Ginkgo runs your suite in two distinct phases. Internalizing this explains nearly every Ginkgo gotcha:

  1. Tree-construction phase. Ginkgo invokes every container body exactly once to discover the structure of your suite. It collects — but does not run — the closures you pass to setup and subject nodes. The result is a tree it flattens into a list of specs.
  2. Run phase. Ginkgo walks the flattened spec list (randomized, possibly in parallel) and, for each spec, runs its setup closures, then its one subject closure, then its cleanup closures.

Container bodies run at construction time. Setup/subject closures run later, at run time. The consequences you must internalize:

  • No assertions in container bodies. They'd run once during construction, with no spec active — not as part of any test. Put assertions in It or BeforeEach.
  • No initialization in container bodies. A variable set in a Describe body is set once, shared across every spec, and mutated by whichever spec runs first. Declare in the container, initialize in BeforeEach so every spec gets a pristine copy. → ginkgo:writing-specs.
  • Loops that build specs run at construction time — that's how you generate specs dynamically, but it also means closure-captured loop variables and any data the loop reads must be available then, not in BeforeSuite. → ginkgo:tables-and-dynamic-specs.

Spec independence — the assumption everything rests on

Ginkgo assumes every spec is independent. This is what lets it randomize order (--randomize-all), run specs in parallel across processes (-p), and run any subset (--focus/labels). The rule that keeps you honest: declare in container, initialize in setup. Deliberate cross-spec dependencies break randomization and parallelism — when you genuinely need ordering, say so explicitly with an Ordered container (→ ginkgo:ordering-and-flakes) rather than relying on definition order.

The Parallelism Model

Ginkgo's parallelism model is process-based: each process runs a subset of the specs, with no shared memory.

The node taxonomy at a glance

  • Containers — Describe, Context, When (identical; pick the one that reads best). Organize the tree.
  • Subjects — It, Specify (identical). The actual test; contains the assertions.
  • Setup — BeforeEach/AfterEach (around every spec), JustBeforeEach/JustAfterEach (split configuration from creation), BeforeAll/AfterAll (once per Ordered container), BeforeSuite/AfterSuite (once per suite), SynchronizedBeforeSuite/SynchronizedAfterSuite (for common setup, then per-process setup when parallel). DeferCleanup registers teardown inline; DeferOnFailure registers failure-only diagnostics that run before teardown.
  • Reporting — ReportAfterEach/ReportAfterSuite etc. observe results. → ginkgo:reporting.
  • Decorators — modifiers attached to any node: Serial, Ordered, Label, Focus, FlakeAttempts, SpecTimeout, … → ginkgo:decorators.

Failures work by panic: Fail (which Gomega calls for you) panics; Ginkgo recovers it, records the failure, and runs cleanup. A goroutine that might fail needs defer GinkgoRecover() or its panic crashes the suite. → ginkgo:timeouts-and-async.

Where to go next

  • Wiring Ginkgo into a project (bootstrap, RunSpecs, the CLI, dot-import alternatives) → ginkgo:setup
  • Authoring specs (containers, subjects, setup/cleanup, the construction-time pitfalls) → ginkgo:writing-specs
  • Table-driven and generated specs (DescribeTable, shared behaviors) → ginkgo:tables-and-dynamic-specs
  • Looking up a decorator → ginkgo:decorators
  • Running a subset (focus, skip, labels) → ginkgo:filtering
  • Running in parallel / integration suites → ginkgo:parallelism
  • **Ordered containers and fl
자주 묻는 질문

Ginkgo란 무엇인가요?

Go 프로그래밍 언어를 위한 테스트 프레임워크이며, 읽기 쉬운 문장 같은 스타일을 씁니다.

이 스킬이 테스트를 대신 써 주나요?

아니요. 테스트 작성을 안내하는 배경 지식을 주며, 세부 내용은 같은 묶음의 다른 가이드가 다룹니다.

ginkgo 명령을 써야 하나요?

이 스킬은 표준 go test 명령보다 ginkgo 명령줄 도구를 권장합니다.

상세 정보

작성자의 원본 설명

The Ginkgo mental model for writing Go tests — the one idea that explains everything (Ginkgo builds a spec tree at construction time, then runs it) and its consequences for how you write specs, plus spec independence and the node taxonomy. Use this first when you start working with Ginkgo in a project, or to decide how to approach a Ginkgo task. Routes to the other ginkgo:* skills.

repo: onsi/ginkgo

인기도

GitHub 스타
9.1k
순위
#12303
라이선스
MIT
업데이트
2026. 10. 9.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬