Just don't ask about the name
go install github.com/sentiens/goptest@latest
Only GPT4 is supported. TODO: More configuration options.
-
Set OPENAI_API_KEY environment variable
-
First generate specification for the tested code:
goptest -cases=true -what="Add function" -spec-file=specs.yaml -code-files=testcode.go
-
Review and edit
specs.yml
code -
Run to generate tests code
goptest -spec-file=specs.yaml -code-files=testcode.go -output-file=generated_test.go