An extremely flexible Go deep comparison library that extends the standard testing package with operators and helpers.
go-testdeep is a Go library that extends the standard testing package with deep comparison capabilities using a flexible operator system. It solves the problem of rigid equality checks in Go tests by allowing developers to match data structures with conditions like ranges, partial matches, and custom transformations.
Go developers writing tests for complex data structures, APIs, or applications requiring expressive and maintainable assertions beyond simple equality.
Developers choose go-testdeep for its operator-based flexibility, rich error reporting, and seamless integration with Go's testing ecosystem, offering a more powerful alternative to `reflect.DeepEqual` or basic assertion libraries.
Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers a wide range of operators like Between, Struct, and Smuggle for non-exact matches, enabling expressive tests for complex data structures without rigid equality constraints.
Provides detailed, colored diff output on test failures, making it easy to identify mismatches in nested or large data structures, as shown in the README's error output example.
Dependency-free and designed to work directly with the standard testing package, ensuring compatibility and ease of adoption without external dependencies.
Includes tdhttp for HTTP API testing with automatic JSON marshalling and tdsuite for structured test suites, extending functionality beyond basic comparisons.
The operator system and advanced features like anchoring require time to master, which can be overwhelming for developers accustomed to simpler assertion libraries.
Compared to more popular alternatives like testify, go-testdeep has a smaller user base, which may result in fewer third-party resources, plugins, or community support.
Using operators for deep comparisons can introduce runtime overhead compared to direct equality checks, potentially slowing down test execution in performance-sensitive scenarios.