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

reporting

하는 일

이 스킬은 Ginkgo 테스트 결과가 어떻게 보이는지 조정하고, 이를 기계가 읽을 수 있는 보고서로 저장하는 방법을 설명합니다. 명확한 테스트 출력이나 다른 도구용 보고서를 원하는 개발자를 위한 것입니다.

사용하는 경우

  • ✓화면에 보이는 테스트 결과의 세부 수준을 늘리거나 줄이고 싶을 때.
  • ✓Ginkgo 테스트에서 JSON이나 JUnit 보고서 파일이 필요할 때.
  • ✓Go 테스트의 코드 커버리지나 성능을 확인하고 싶을 때.

스킬 링크

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

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

사용 방법

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

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

Use this skill to help me: https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/reporting/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 테스트가 JUnit 보고서를 저장하게 해 주세요. CI 시스템이 읽을 수 있어야 합니다.”

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

작동 방식

이 스킬은 자세한 출력을 보여 주고, 보고서 파일을 쓰고, 커버리지나 속도를 측정하는 명령 옵션을 보여 줍니다.

기술 내용 (원본 SKILL.md)

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

Reporting and profiling

How to produce reports and feed data into them. To read a failing report as an agent (the jq failure-diagnosis workflow), see ginkgo:debugging-failures. Docs: https://onsi.github.io/ginkgo/#generating-machine-readable-reports and https://onsi.github.io/ginkgo/#attaching-data-to-reports.

Console output

Flag Effect
--succinct Minimal (default when running multiple suites).
(none) Normal — detail only for failed specs (default, single suite).
-v Full timeline for every spec; streams live in series.
-vv -v plus node > Enter/< Exit events and every failure (not just the primary).
--trace Full stack trace on every failure, not just panics.
--no-color / GINKGO_NO_COLOR=TRUE Disable color.
--github-output Format console output for GitHub Actions.

In parallel (-p), -v/-vv timelines can't stream — the streams would interleave, so Ginkgo emits each spec's full timeline after that spec completes. → CI flags in ginkgo:ci.

Machine-readable reports

ginkgo -r --json-report=report.json --output-dir=./.reports
  • --json-report is native and richest — an array of types.Report, each with SpecReports[] of types.SpecReport (godoc); build tooling against the types package.
  • --junit-report=x.xml, --teamcity-report=x, --gojson-report=x.go.json exist for external CI but lose Ginkgo metadata — use them to feed a system, not to diagnose. (JUnit maps a Label("owner:XYZ") to the Owner attribute.)
  • --output-dir=DIR collects all files in one place; under -r all suites merge into one report file. --keep-separate-reports writes one PACKAGE_report.json per package instead.
  • Every machine-readable report embeds the full -vv timeline regardless of console verbosity. Run the suite quiet and mine the file — you don't need -vv on the console to get rich detail in the report.

Programmatic reporting nodes

CurrentSpecReport() works in any run-phase closure — use it for in-spec conditional diagnostics:

AfterEach(func() {
  if CurrentSpecReport().Failed() {
    GinkgoWriter.Println(libraryClient.DebugLogs())   // expensive diagnostics, only on failure
  }
})

For custom report files, don't roll your own in AfterEach — use reporting nodes:

  • ReportAfterEach(func(r SpecReport){...}) / ReportBeforeEach — run for every spec including skipped/pending (unlike AfterEach), after all AfterEaches. A failure here fails the spec. In parallel they run on each process concurrently — never write a shared file from them (you'll get interleaved garbage).
  • ReportBeforeSuite / ReportAfterSuite("name", func(r Report){...}) — top-level, and run only on process #1. ReportAfterSuite receives the Report aggregated across all parallel processes — this is the safe place for custom suite-level report files:
ReportAfterSuite("custom report", func(report Report) {
  f, _ := os.Create("report.custom")
  for _, sr := range report.SpecReports {
    fmt.Fprintf(f, "%s | %s\n", sr.FullText(), sr.State)
  }
  f.Close()
})

Reporting nodes can be made interruptible by also accepting SpecContext → ginkgo:timeouts-and-async.

Attaching data to a spec: AddReportEntry

It("is reported", func() {
  AddReportEntry("Publish stats", stats, ReportEntryVisibilityFailureOrVerbose)
})

AddReportEntry(name, value, ...args) attaches arbitrary data to the current spec; it lands in SpecReport.ReportEntries, in all machine-readable reports, and (per visibility) on the console. Visibility enum:

  • ReportEntryVisibilityAlways (default) — always printed.
  • ReportEntryVisibilityFailureOrVerbose — only on failure or -v (like GinkgoWriter).
  • ReportEntryVisibilityNever — never on console, but still in the JSON report.

For failure-only diagnostics, call AddReportEntry from a DeferOnFailure callback (→ ginkgo:writing-specs).

value is JSON-round-tripped into the report (retrieve via entry.GetRawValue() / json.Unmarshal(entry.Value.AsJSON, ...)). A fmt.Stringer/types.ColorableStringer controls console rendering; pass a pointer to capture later mutations. AddReportEntry decorators (Offset, CodeLocation, ReportEntryVisibility) → ginkgo:decorators.

Recap (owned by ginkgo:writing-specs): GinkgoWriter buffers log output a

자주 묻는 질문

JUnit 보고서란 무엇인가요?

많은 빌드 및 테스트 시스템이 테스트 결과를 보여 주기 위해 읽을 수 있는 표준 파일 형식입니다.

실행되는 각 테스트를 볼 수 있나요?

네. 자세한 옵션은 테스트마다 타임라인을 보여 주며, 병렬 실행에서는 각 테스트가 끝난 뒤 타임라인이 나옵니다.

이 스킬이 테스트를 바꾸나요?

주로 명령 옵션과 보고 코드를 다루므로, 보고 단계를 추가하지 않는 한 테스트는 그대로입니다.

상세 정보

작성자의 원본 설명

Generate, consume, and enrich Ginkgo reports — console verbosity (-v/-vv/--trace/--no-color/--succinct), machine-readable reports (--json-report/--junit-report with --output-dir/--keep-separate-reports), programmatic reporting nodes (ReportAfterEach, ReportAfterSuite, CurrentSpecReport), AddReportEntry with ReportEntryVisibility, and profiling (--cover/--race/--cpuprofile/--memprofile). Use when you need a report file, custom suite-level reporting, attaching data to a spec, controlling console output, or profiling a suite.

repo: onsi/ginkgo

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬