6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
Gotests is a tool that automatically generates table-driven tests for Go functions and methods by analyzing their signatures. It supports filtering, custom templates, and even AI-generated test cases, making it efficient for developers to ensure test coverage.
If you do, here's more
gotests is a Go test generator that creates table-driven tests automatically from your code. It examines function signatures and generates the necessary test scaffolding, which saves time and maintains consistency. The tool works with any Go project right out of the box, requires no configuration, and supports Go 1.18 and later, including generics.
Key features include flexible filtering options for generating tests for specific functions or entire packages, and automatic import handling for test files. It generates comprehensive test structures that correctly handle different types, and it can process entire directory trees. Users can utilize built-in or custom templates, with support for parallel test execution. A standout feature is its integration with local AI models via Ollama, which can generate realistic test cases based on function logic.
When generating tests, gotests can produce a variety of cases, including edge cases and error conditions, while prioritizing privacy by keeping all data local. The tool allows for customization through various command-line options, such as generating tests for exported functions or excluding certain functions based on patterns. The workflow is straightforward: you can run commands to generate tests and specify output preferences, making it an efficient solution for Go developers looking to streamline testing.
Questions about this article
No questions yet.