- 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
679 B
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/astor prompt with code snippets. - Prompt Grok: "Generate table-driven tests for this Go code."
- Output
*_test.go, create.bak, preview/apply likeedit. - Verify:
go test -v ./...post-generation.
CLI example:
grokkit testgen internal/grok/client.go