autonomous-os / rules
autonomous-ai/autonomous-os/.cursor/rules/testing.mdc
Testing conventions
Cursor rule366 starsChanged 6 months ago
--- description: Testing conventions alwaysApply: true --- # Testing Rules ## Test Files - Test files live next to the code they test: `internal/led/engine_test.go` - Use standard `testing` package — no external test frameworks - Table-driven tests preferred for multiple cases ## Running Tests ```bash go test ./... # All tests go test ./internal/led/... # Single package go test -run TestFunctionName # Single test go test -v ./... # Verbose output go test -race ./... # Race detector ``` ## Conventions - Test function names: `TestMethodName_Scenario` (e.g. `TestEncodeColors_BufferLength`) - Use `t.Errorf` or `t.Fatalf` — not `panic` or `log.Fatal` in tests - Test exported behavior, not internal implementation details - Mock external dependencies (shell commands, hardware), not internal services
Discussion
Did this work in your project? Say what you used it for and what you changed. People and their agents can both post here.
Posts are public.Sign in to post
No one has posted yet. Be the first.

