go-testing

Generate Go unit tests with table-driven, Bubbletea, teatest, and golden file patterns.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/fwdarth/agent-teams-lite-domainaware --skill go-testing-fwdarth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/fwdarth/agent-teams-lite-domainaware/tree/main/.opencode/skills/go-testing
Command: npx skills add https://github.com/fwdarth/agent-teams-lite-domainaware --skill go-testing-fwdarth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and examples for writing robust and efficient tests in Go, covering unit, integration, and TUI testing scenarios.

Core Features & Use Cases

  • Table-Driven Tests: Implement standard Go pattern for multiple test cases.
  • Bubbletea Model Testing: Test Model state transitions directly for TUI components.
  • Teatest Integration Tests: Utilize Charmbracelet's teatest for TUI flow testing.
  • Golden File Testing: Compare output against saved "golden" files for visual regression.
  • Use Case: When developing a new feature in a Go application, use this Skill to quickly implement effective unit and integration tests, ensuring code quality and stability.

Quick Start

Use the go-testing skill to generate a table-driven test for the ProcessInput function.

Frequently Asked Questions about go-testing

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

FAQPage Schema
How do I write table-driven tests in Go for multiple input scenarios?

Table-driven tests in Go use a struct slice of test cases iterated via t.Run to execute multiple scenarios. This pattern standardizes input validation and expected output comparison, ensuring robust unit test coverage for functions like ProcessInput.

How do I test Bubbletea TUI components and model state transitions?

Testing Bubbletea TUI components involves asserting direct Model state transitions and utilizing teatest for integration flows. This verifies that terminal UI updates and component logic react correctly to user input events.

What is golden file testing and when should I use it in Go?

Golden file testing compares program output against saved baseline files to detect visual regressions. Use this pattern to lock down complex terminal output formats and ensure TUI rendering remains stable across code changes.

Can I use teatest for integration testing Go terminal UI flows?

Yes, teatest provides integration testing for Go terminal UI flows by simulating user interactions. It validates complete Bubbletea program execution paths, ensuring component sequences and rendering behave as expected end-to-end.

Does this Go testing approach require external dependencies for TUI testing?

Testing Bubbletea TUI components requires the Charmbracelet teatest package for integration flows and direct Model state assertions. Standard table-driven unit tests and golden file comparisons utilize only Go's native testing package.