unit-test

Solid

Use when the user asks for unit tests (e.g, "单元测试", "unit test"), wants to add/fix Go tests, wants table-driven and subtest organization, or wants to enforce a minimum coverage gate (default 80% for logic packages). Prioritize bug discovery (especially boundary, mapping loss, and concurrency defects) over test volume. Do NOT use for benchmarks, fuzz tests, integration tests, E2E tests, load tests, or mock generation.

Testing & QA 27 stars 5 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
48
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Go Unit Test Create and refine Go tests for this repository with table-driven cases and explicit bug-hunting rules. ## Quick Reference | When you need to… | Jump to | |---|---| | Quick tests for simple functions | Light mode — §Execution Modes | | Normal feature development | Standard mode (default) — §Execution Modes | | High-risk / release / concurrent code | Strict mode — §Execution Modes | | Fix or triage failing tests | §Test Execution Hardening | | Supplement coverage on existing code | §Coverage Gate Policy | | Know if a Killer Case is required | Standard + Strict modes: always required — §Killer Case | | Check Go version compatibility | §Go Version Gate | | Write a Killer Case | §Killer Case — Definition + load `references/killer-case-patterns.md` | ## Hard Rules - Name test files as `<target_file>_test.go`, co-located with source. - Assertion strategy (adapt to project): - **If project uses testify**: `require` for fatal preconditions, `assert` for value checks. - **If project uses standard library only**: use `t.Fatalf` for fatal preconditions, `t.Errorf` for value checks. Include got/want in messages: `t.Errorf("Name = %q, want %q", got, want)`. - **If project uses go-cmp**: use `cmp.Diff` for deep struct comparison. Prefer over field-by-field assertion for complex output. - **Detection**: Check existing `_test.go` files for `"github.com/stretchr/testify"` imports. Follow project convention. - Keep tests deterministic; isolate time, randomness, envir...

Details

Author
johnqtcg
Repository
johnqtcg/awesome-skills
Created
4 months ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Listed

unit-test

Project-aware unit testing guide with mock patterns, TDD discipline, and best practices. Auto-detects test framework (Jest/Vitest) and provides appropriate examples. Use when: (1) writing or fixing unit tests, (2) user says "寫測試", "write test", "補測試", "add test", (3) user encounters mock patterns or test failures, (4) user asks how to test a composable, component, or store, (5) user says "mock imports", "test store", "怎麼測", "測試怎麼寫", (6) reviewing test quality: "unit test review", "review tests", "check test quality", "測試審查", "review 測試", "測試品質", "檢查測試品質", (7) TDD workflow: "TDD", "test driven", "紅綠燈", "先寫測試", "test first", "red green refactor".

4 Updated 2 days ago
HsuanYuLee
Testing & QA Listed

go-test

When the user wants to design, implement, debug, or optimize Go tests using the standard testing package, testify, and related Go ecosystem libraries. Use when the user mentions "go test," "table-driven tests," "t.Run," "subtests," "testify," "require / assert," "go test -race," "go test -bench," "go test -fuzz," "TestMain," "t.Cleanup," "httptest.Server," or "go-cmp." For JS/TS see jest-vitest. For Python see pytest. For Java see junit-testng. For .NET see xunit-nunit.

1 Updated yesterday
aks-builds
Testing & QA Solid

golang-testing

Provides a comprehensive guide for writing production-ready Golang tests. Covers table-driven tests, test suites with testify, mocks, unit tests, integration tests, benchmarks, code coverage, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, memory leaks, CI with GitHub Actions, and idiomatic naming conventions. Use this whenever writing tests, asking about testing patterns or setting up CI for Go projects. Essential for ANY test-related conversation in Go.

0 Updated today
guynhsichngeodiec