askill
testing

testingSafety 90Repository

Standards for unit testing, table-driven tests, and mocking in Golang.

197 stars
3.9k downloads
Updated 2/2/2026

Package Files

Loading files...
SKILL.md

Golang Testing Standards

Priority: P0 (CRITICAL)

Principles

  • Table-Driven Tests: The idiomatic way to write tests in Go.
  • Subtests (t.Run): Run table entries as subtests for better reporting.
  • Parallel Usage: Use t.Parallel() for independent tests to speed up execution.
  • Mock Interfaces: Mock at the boundaries (interfaces).

Tools

  • Stdlib: testing package is usually enough.
  • Testify (stretchr/testify): Assertions (assert, require) and Mocks.
  • Mockery: Auto-generate mocks for interfaces.
  • GoMock: Another popular mocking framework.

Naming

  • Test file: *_test.go
  • Test function: func TestName(t *testing.T)
  • Example function: func ExampleName()

Anti-Patterns

  • Sleeping in tests: Use channels/waitgroups or retry logic.
  • Testing implementation details: Test public behavior/interface.

References

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

92/100Analyzed 2/6/2026

A high-quality, well-structured guide for Go testing standards. It includes clear triggers, idiomatic principles, and useful tool recommendations.

90
95
95
85
85

Metadata

Licenseunknown
Version-
Updated2/2/2026
PublisherHoangNguyen0403

Tags

testing