grokkit/todo/completed/testgen.md
Greg Gauthier c54bc511c9
Some checks failed
CI / Test (push) Failing after 27s
CI / Lint (push) Has been skipped
CI / Build (push) Has been skipped
feat(testgen): add AI unit test generation command
- Implement `grokkit testgen` for Go/Python/C/C++ files
- Add language-specific prompts and test file conventions
- Include backups, previews, auto-apply flag
- Update README with docs and examples
- Add unit tests for helper functions
- Mark todo as completed
2026-03-02 21:57:33 +00:00

679 B

grokkit testgen [path...]

Description: Generate comprehensive unit tests for Go files/packages using AI analysis of source code.

Benefits:

  • Boost test coverage from current ~72% baseline automatically.
  • Enforces modern table-driven tests with t.Parallel() matching codebase style (e.g., internal/version/version_test.go).

High-level implementation:

  • Extract funcs/structs via go/ast or prompt with code snippets.
  • Prompt Grok: "Generate table-driven tests for this Go code."
  • Output *_test.go, create .bak, preview/apply like edit.
  • Verify: go test -v ./... post-generation.

CLI example:

grokkit testgen internal/grok/client.go