go-integration-tests
Originally fromcristiano-pacheco/ai-rules
Installation
SKILL.md
Go Integration Tests
Generate comprehensive Go integration tests using testify suite patterns with real database and infrastructure dependencies.
When to Use
- Test use cases against real databases via containers
- Verify end-to-end flows with real infrastructure
- Assert DB state, side effects, and error conditions
Planning Phase
Before writing tests, identify:
- Test Location: Tests go in
test/integration/mirroring the source path frominternal/- Example:
internal/modules/identity/usecase/user/user_register_usecase.go→test/integration/modules/identity/usecase/user/user_register_usecase_test.go
- Example:
- Dependencies: Identify real dependencies (database, redis) vs mocked ones (email, external APIs, metrics)
- Test Cases: Define scenarios covering happy paths, edge cases, error conditions, and DB state verification
- Naming: Use descriptive names:
TestExecute_ValidInput_ReturnsUser,TestExecute_DuplicateEmail_ReturnsError
Related skills
More from cristiano-pacheco/ai-tools
go-gorm-model
Generate GORM persistence models. Use when creating database models using GORM.
78go-chi-handler
Generate Chi HTTP handlers, use case orchestration, Use for REST endpoint handlers or web http handlers.
26go-usecase
Generate use cases. Use when creating business operations, CRUD use cases, or any Execute-based module operation.
22go-enum
Generate type-safe enums with validation. Use when creating enums, defining constants, or adding enum types.
20go-cache
Generate Redis-backed Go cache. Invoke whenever user mentions cache or Redis.
20go-service
Generate services. Use for reusable single-responsibility business services or domain services.
18