# Go Testing

> Escribe tests en Go con la biblioteca estándar: unitarios, table-driven, con mocks y cobertura, incluyendo modelos Bubbletea con teatest.

- Skill: `leandrobenjaminl/go-testing` (Agent Skill)
- Install (CLI): `npx skillmds@latest add leandrobenjaminl/go-testing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leandrobenjaminl/go-testing/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools, Testing & QA
- Tags: Bubbletea, Coverage, Go, Mock, Table Driven, Teatest, Testing
- License: MIT
- Author: LeandroBenjaminL (https://skillmd.com/u/leandrobenjaminl)
- Updated: 2026-08-22
- Page: https://skillmd.com/skills/leandrobenjaminl/go-testing

---


# Skill: go-testing

Testing en Go. Table-driven, parallel, sin magia.

## Trigger

- Escribiste una función en Go y necesitás testearla
- Querés agregar cobertura a un paquete
- Usás Bubbletea y necesitás testear el modelo
- Un test existente falla y hay que debuggearlo

## Workflow LEND

1. ANALIZAR
   ├── Paquete: ¿funciones puras, I/O, Bubbletea model?
   ├── Tipo: unitario (funciones) o integración (handler, DB)
   ├── Dependencias: ¿interfaces para mockear?
   └── Cobertura actual: go test -cover

2. OFRECER (Menú del Senior)
   ├── A) Test unitario — table-driven test para funciones puras
   ├── B) Test con mock — interfaces + stub para dependencias externas
   └── C) Bubbletea test — teatest para modelos TUI

3. ELEGIR → confirmación

4. HACER
   ├── Archivo: *_test.go, misma carpeta que el código
   ├── Table-driven: []struct{name, input, expected} + t.Run
   ├── t.Parallel() en tests independientes
   ├── Cobertura: go test -cover -coverprofile=coverage.out
   ├── Bubbletea: teatest.NewTestModel + teatest.WaitFor
   └── Assert: testing package, sin librerías externas de assert

5. VERIFICAR
   ├── go test ./... pasa sin errores
   ├── Cobertura > 70% en paquetes críticos
   └── Los tests paralelos no compiten por recursos compartidos

