gotests scans Go source and writes table-driven test scaffolds with imports and type-aware cases. Optional Ollama integration can suggest test values from function bodies.
Overview
gotests is a CLI and editor-integrated tool that generates Go test files from existing functions and methods. It builds table-driven structures and fills parameter types automatically.
Filtering flags limit generation to exported symbols, specific functions, or entire packages including recursive ./... runs. Custom templates support testify or team conventions.
An optional AI path sends function signatures and bodies to a local Ollama model to propose realistic inputs, edge cases, and error conditions while keeping data on the machine.
Editor plugins exist for Sublime Text, Vim, VS Code, Emacs, and GoLand, while go install provides the command-line entry point on Go 1.24 or newer.
Key features
- Table-driven test scaffolds
- Auto import insertion
- Generics support
- Recursive package mode
- Custom templates
- Optional Ollama cases
- Editor plugin ecosystem
Use cases
- Bootstrapping Go unit tests
- Consistent test structure
- Speeding test setup
- AI-assisted test ideas