18 lines
679 B
Markdown
18 lines
679 B
Markdown
|
|
# `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
|
||
|
|
```
|