Skip to content

Testing

ELMOS uses Go’s testing framework with mocks for infra.

  • Unit tests in *_test.go files
  • Mocks in core/infra/*/mock.go
  • Table-driven tests for commands
Terminal window
task test # Run all tests
task test:cover # With coverage report

Infra interfaces mocked for domain testing:

type MockExecutor struct {
RunFunc func(cmd string, args ...string) error
// ...
}
func (m *MockExecutor) Run(cmd string, args ...string) error {
return m.RunFunc(cmd, args...)
}

Used in domain tests to verify calls.

Target: 80%+ coverage. Generated via go test -cover.

Limited; focus on unit tests. Manual testing for full workflows.

Tests run on PRs and pushes.

  • Test public APIs
  • Mock external deps
  • Use assert for checks
  • Table-driven for multiple cases