Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. gofight

gofight

MITGov2.2.2

A Go library for testing HTTP handlers and web frameworks like Gin, Echo, and Mux.

GitHubGitHub
445 stars39 forks0 contributors

What is gofight?

Gofight is a testing utility for Go web applications that simplifies writing tests for HTTP handlers and popular web frameworks. It provides a fluent API to simulate HTTP requests and validate responses, making it easier to ensure API reliability.

Target Audience

Go developers who need to write tests for HTTP handlers in applications using net/http, Gin, Echo, or Gorilla Mux frameworks.

Value Proposition

Developers choose Gofight for its clean, chainable interface that reduces boilerplate code and its multi-framework support, which allows consistent testing across different web frameworks.

Overview

Testing API Handler written in Golang.

Use Cases

Best For

  • Testing HTTP handlers in Go applications using the native net/http package.
  • Writing integration tests for APIs built with the Gin, Echo, or Gorilla Mux frameworks.
  • Simulating and validating file uploads in multipart form data tests.
  • Testing API endpoints with various payload types like JSON, form data, and raw body content.
  • Debugging HTTP request-response cycles during test execution with detailed output.
  • Reducing boilerplate code in HTTP handler tests through a fluent, chainable API.

Not Ideal For

  • Projects using unsupported Go web frameworks like Fiber or Chi
  • Teams wanting a self-contained testing solution with built-in assertions
  • Tests requiring behavior-driven development (BDD) syntax or tools
  • Scenarios where minimal abstraction over Go's standard httptest package is preferred

Pros & Cons

Pros

Broad Framework Compatibility

Supports net/http, Gin, Echo, and Gorilla Mux, enabling consistent testing across multiple popular frameworks without switching tools.

Fluent, Chainable API

Offers a clean, readable interface that reduces boilerplate code, as shown in examples with methods like GET().SetHeader().Run().

Robust File Upload Testing

Includes SetFileFromPath for simulating multipart file uploads with both absolute paths and byte content, essential for testing upload handlers.

Integrated Debugging

Provides a debug mode via SetDebug(true) that outputs detailed request and response information, aiding in test development and troubleshooting.

Cons

Limited Framework Ecosystem

Only supports a subset of Go web frameworks; for instance, it lacks support for newer frameworks like Fiber, which may require workarounds or alternative tools.

External Assertion Dependency

Relies on third-party libraries like testify for assertions, as seen in examples, adding setup complexity and potential versioning issues.

Additional Parsing Overhead

For JSON response validation, examples use external parsers like jsonparser or gjson, introducing extra dependencies beyond the core testing utility.

Frequently Asked Questions

Quick Stats

Stars445
Forks39
Contributors0
Open Issues4
Last commit9 days ago
CreatedSince 2016

Tags

#http-handler#unit-testing#integration-testing#gorilla-mux#api-testing#testing#golang#gin-framework#testing-tools#echo-framework#go

Built With

G
Go

Included in

Go169.1k
Auto-fetched 10 hours ago

Related Projects

TestifyTestify

A toolkit with common assertions and mocks that plays nicely with the standard library

Stars26,204
Forks1,916
Last commit6 days ago
KeployKeploy

Open-source platform for creating safe, isolated production sandboxes for API, integration, and E2E testing.

Stars18,443
Forks2,353
Last commit10 hours ago
GoConveyGoConvey

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

Stars8,406
Forks559
Last commit2 years ago
testcontainers-gotestcontainers-go

Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.

Stars4,971
Forks637
Last commit11 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub