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