go-integration-tests
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
More from cristiano-pacheco/ai-rules
go-unit-tests
Generate Go unit tests using testify suite/assert patterns. Use when writing test suites with mocks, testing standalone functions, or adding unit test coverage.
25go-create-usecase
Generate Go use cases for modular architecture using ports-based dependencies and decorator-based observability. Use when implementing business actions in internal/modules/<module>/usecase/ such as create, update, list, delete, status transitions, uploads, notifications, or any domain operation that orchestrates repositories/services.
11go-cache
Generate Redis-backed Go cache. Invoke whenever user mentions cache or Redis.
11go-chi-handler
Generate Chi HTTP handlers, use case orchestration, Use for REST endpoint handlers or web http handlers.
10creating-cursor-rules-skill
Expert guidance for creating effective Cursor IDE rules with best practices, patterns, and examples
9go-chi-router
Generate Chi router files with route registration and Fx wiring. Use for CRUD routes, custom endpoints, versioned APIs, route groups, or any HTTP route setup.
9