golang-testing

Implement idiomatic Go testing with table-driven tests, subtests, benchmarks, and fuzzing.

1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/vrcms/everything-qwen-code --skill golang-testing-vrcms
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-testing
Source: https://github.com/vrcms/everything-qwen-code/tree/main/.qwen/skills/golang-testing
Command: npx skills add https://github.com/vrcms/everything-qwen-code --skill golang-testing-vrcms

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the challenge of maintaining high code quality and reliability in Go projects by providing a structured, idiomatic approach to testing that covers everything from basic unit tests to advanced fuzzing and benchmarking.

Core Features & Use Cases

  • Table-Driven Testing: Standardizes test cases to ensure comprehensive coverage with minimal boilerplate code.
  • Advanced Testing Techniques: Provides patterns for subtests, parallel execution, golden files, and interface-based mocking.
  • Performance & Security: Includes templates for benchmarking performance-critical code and implementing fuzz tests to discover edge-case input vulnerabilities.

Quick Start

Apply the golang-testing skill to generate a table-driven test suite for the current package functions.

Frequently Asked Questions about golang-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write table-driven tests in Go?

Table-driven tests in Go standardize test cases to ensure comprehensive coverage with minimal boilerplate. You define a struct slice of inputs and expected outputs, then iterate through them using subtests to validate function behavior systematically.

What is fuzzing in Go and how does it validate inputs?

Fuzzing in Go is an automated testing technique that continuously generates randomized input data to discover edge-case vulnerabilities. It validates input handling by feeding malformed arguments to functions, exposing crashes and unexpected behavior.

How do I benchmark performance-critical code in Golang?

Benchmarking performance-critical code in Golang involves using the testing package's Benchmark functions to measure execution time and memory allocations. This facilitates performance profiling by running code iterations and reporting allocation metrics.

Does this approach support integration testing with mock dependencies?

Yes, this testing approach supports integration testing with mock dependencies by utilizing interface-based mocking patterns. It allows you to substitute real dependencies with mocks during test execution to isolate and verify module interactions.

What's the best way to execute Go subtests in parallel?

Executing Go subtests in parallel is achieved by calling the Parallel method within your subtest functions. This pattern allows multiple test cases to run concurrently, significantly reducing overall test suite execution time.

When should I use golden files in Go testing?

Golden files in Go testing should be used when validating complex, large-scale output that is difficult to assert manually. They store expected output data in separate files, allowing tests to compare actual results against the golden snapshot.