With zero external dependencies module provides:
assert(72 hand-picked assertion functions),mockandmockerpackages.- Golden file testing helpers in
goldypackage. - Assortment of helpers in
kitpackage. - Configurable any type string dumper in
dumppackage. - Build your own assertions with ease using
checkpackage. - Test your test helpers with
testerpackage.
Provide a comprehensive suite of tools designed to make testing more efficient, enjoyable to write, and integral to the development process.
Whether you're a seasoned tester or just starting out, tools in this module are being crafted to meet your needs, providing a solid foundation for ensuring code reliability in projects of all sizes.
At the heart of the module lies a commitment to minimalism and an exceptional developer experience (DX). By maintaining zero external dependencies, the framework stays lightweight and fast, free from the potential complexities and conflicts that third-party modules can introduce. Our documentation is being carefully designed to be thorough, clear, and packed with practical examples, empowering you to master the module with ease. Expect a great DX with features like a fluent, chainable API, descriptive error messages for quick debugging, all tailored to streamline your testing workflow.
The testing module is built as a collection of modular, laser-focused
packages, each targeting a specific aspect of testing. For instance, you might
leverage the assert package for assertions, the mock and mocker packages
for test doubles, or the kit package to keep your tests readable and
minimalistic. The modularity lets you customize your testing setup to fit your
project’s exact needs, avoiding unnecessary overhead. Beyond customization, the
extensible architecture invites you to create your own test helpers.
To install CTX42 Testing Module, use go get:
go get github.com/ctx42/testingThis will make all the package modules available to you.
Packages used in test cases.
- Package assert provides assertion toolkit.
- Package check provides equality toolkit used by
assertpackage. - Package goldy provides basic golden file support.
- Package kit provides all sorts of test helpers that are not assertions.
- Package mock provides primitives for writing interface mocks.
- Package mocker provides an interface mock generator.
- Package must provide basic test helpers which panic on error.
Packages are used to create custom checks, assertions, and helpers.
- Package dump provides a configurable renderer of any type to a string.
- Package notice helps to create nicely formatted assertion messages.
- Package tester provides facilities to test
Test Helpers.
Click on the package link to see its README.md file with documentation. Also,
most of the packages contain examples_test.go file with usage examples.
I’ve written several blog posts tied to this repository. If you’re curious about the behind-the-scenes details of how this package is coming together, check them out and share your thoughts — I’d love to hear what you think! Any feedback is greatly appreciated.
