go-testing

Automate Go testing patterns for Bubbletea TUI applications.

1.9k|282|Updated Nov 19, 2023
One-click install
npx skills add https://github.com/Gentleman-Programming/Gentleman.Dots --skill go-testing-gentleman-programming
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/Gentleman-Programming/Gentleman.Dots/tree/main/skills/go-testing
Command: npx skills add https://github.com/Gentleman-Programming/Gentleman.Dots --skill go-testing-gentleman-programming

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go testing patterns for Bubbletea TUI components and broader Go projects, providing reusable strategies to reduce boilerplate and improve reliability.

Core Features & Use Cases

  • Table-Driven Tests: standard pattern to cover multiple inputs with concise test logic.
  • Bubbletea Model Testing: verify state transitions and rendering logic directly in tests.
  • Teatest Integration & Golden File Testing: validate interactive flows and compare outputs against golden files.
  • Organization & CI: structure tests for maintainability and CI integration.

Quick Start

Install and use Go tooling to run tests. Create test files under _test.go, run go test ./... to execute unit tests, and integrate teatest for TUI flows as shown in examples.

Frequently Asked Questions about go-testing

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

FAQPage Schema
How do I test Bubbletea TUI applications in Go?

Testing Bubbletea TUI applications involves verifying model state transitions and rendering logic directly within tests. You can automate these robust Go testing patterns using table-driven tests and teatest integration tests to validate interactive flows reliably.

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

Golden file testing in Go compares your test outputs against pre-approved golden files to validate interactive TUI flows. Use it to detect unintended changes in rendering output and ensure consistent visual behavior across updates.

How do I write table-driven tests for Go projects?

Writing table-driven tests for Go projects uses a standard pattern to cover multiple inputs with concise test logic. Create test files under the _test.go suffix and run go test ./... to execute the unit tests and verify state transitions.

Can I use teatest for integration testing of interactive TUI flows?

Yes, teatest supports integration testing for interactive TUI flows in Go projects. It validates component interactions and compares outputs against golden files, providing guidance on test data organization and CI integration for maintainability.

Do I need the Go toolchain to run teatest integration tests?

Yes, you need the Go toolchain to execute teatest integration tests. The testing patterns require go test to run unit tests and external libraries such as teatest to validate interactive Bubbletea TUI component behaviors.