testing
Testing workflow with gotest CLI, gopush publishing, mocking patterns, WASM/stdlib dual testing, and diagram-driven testing. Use when writing or running tests.
适合你,如果你用 Go 写代码并需要高效测试
/ 通过 npx 安装 校验哈希
npx oh-my-skill add tinywasm/devflow/testing/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- tinywasm/devflow/testing/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify tinywasm/devflow/testing安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
1GitHub stars
~565上下文体积 · 单文件
索引托管
怎么用
商店整理自技能原文 · 版本 6481063 · 表述以原文为准它做什么
安装后,Claude 会使用 gotest 命令运行 Go 测试,用 gopush 发布代码,并遵循标准库测试、模拟、WASM/标准库双测试和图表驱动测试等模式。
什么时候触发
当你在编写或运行 Go 测试时,Claude 会自动采用这些工作流。
装好后可以这样说
Claude 会执行 gotest 命令运行全部测试。
技能原文 SKILL.md
Testing
- Testing Runner (
gotest): For Go tests, ALWAYS use the globally installedgotestCLI command. DO NOT usego testdirectly, and DO NOT invoke it viago run github.com/tinywasm/devflow/cmd/gotest. Simply typegotest(no arguments) for the full suite, orgotest -run TestName. It automatically handles-vet,-race,-cover, WASM tests, and README badges. gotestin Agent Plans: When writing aPLAN.mddestined for an external agent (e.g., Jules), you MUST include the following installation step as the first prerequisite in the plan, because external agents run in isolated environments wheregotestis not globally available: ```bash go install github.com/tinywasm/devflow/cmd/gotest@latest ```- Publishing (
gopush): If tests pass and docs are updated, ALWAYS use the globally installedgopush 'your commit message'CLI command to deploy. DO NOT use standardgit commit/git push, and DO NOT invoke it viago run. It handles testing, tagging, pushing, and updating dependencies automatically.
- Standard Library Only: NEVER use external assertion libraries (e.g.,
testify,gomega). Use only the standardtesting,net/http/httptest, andreflectAPIs. - Mocking (No I/O): Tests MUST use Mocks for all external interfaces to remain fast, deterministic, and side-effect free.
- WASM/Stlib Dual Testing Pattern:
- Separation: Use build tags for isomorphic code (
frontWasm_test.go->//go:build wasm,backStlib_test.go->//go:build !wasm). - Shared Logic: Both files MUST call a shared test runner (e.g.,
RunAPITests(t)) to avoid duplication. - Unified Setup: Use a single
setup_test.goto initialize the library/test server once.
- Diagram-Driven Testing (DDT) & Black-Box Validation:
- Flow Coverage: Logic flows defined in
docs/diagrams/*.mdMUST have corresponding Integration Tests covering all branches/diamonds. - Visual/Binary Outputs: Never write tests that perform exact string/byte matching on complex binary formats (e.g., PDFs, SVGs). Floating-point variations make them brittle. Use black-box integration testing that outputs a file to disk (
os.WriteFile) to be verified visually by the developer.
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →
评论
登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。
…