A flexible HTTP integration test framework for Go with a simple, expressive API for sending requests and validating responses.
go-hit is an HTTP integration test framework for Go that allows developers to write tests for HTTP services by sending requests and validating responses. It solves the problem of testing API endpoints with a fluent, expressive syntax that supports complex assertions, JSON manipulation with JQ, and reusable test steps.
Go developers who need to write integration tests for HTTP APIs, microservices, or web services, especially those requiring detailed response validation and flexible test composition.
Developers choose go-hit for its balance of simplicity and flexibility—it provides a clean, chainable API for common testing tasks while allowing custom step injection, step templating, and granular error handling, making it more powerful than basic HTTP clients without the overhead of heavier frameworks.
http integration test framework
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides chainable methods like Expect().Status().Equal() and Expect().Body().JSON().JQ(), enabling readable and comprehensive assertions without boilerplate code.
Integrates JQ expressions for extracting and asserting specific values in JSON responses, as shown in examples using .JQ(".json.Foo[1]") for precise validations.
Allows creating reusable step combinations with CombineSteps() and runtime modifications using Clear(), improving test maintainability and reducing duplication.
Offers Debug() steps to inspect requests and responses, such as Debug().Response().Body(), aiding in troubleshooting complex integration scenarios.
Supports both shorthand methods (Get(), Post()) and manual construction with URL components and headers, catering to diverse testing needs.
The project has undergone significant API rehauls, like in version 0.5.0, which can disrupt existing test suites and require migration efforts.
Error inspection requires manual type assertion and step identification, as shown in the login example with hitError.FailingStepIs(), adding complexity for simple cases.
Lacks native support for mocking external services, forcing developers to rely on custom steps or external tools for stubbing HTTP responses.
Relies on JQ expressions for advanced JSON queries, which adds a learning curve and potential overhead for developers unfamiliar with JQ syntax.