testing

module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2025 License: MIT

README

gopher.png

This repository is work in progress open sourcing libraries I've created during my time as a Go developer.

Go Report Card GoDoc Tests

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.


Introduction to Ctx42 Testing Module

This repository marks the beginning of CTX42 Testing Module, a collection of testing and assertion packages poised to help developers approach testing. As it develops, it will offer a comprehensive suite of tools designed to make testing more efficient, enjoyable, and integral to the development process.

Whether you're a seasoned tester or just starting out, tools in this module is being crafted to meet your needs, providing a solid foundation for ensuring code reliability in projects of all sizes.

Simplicity and Usability

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.

Modular and Extensible Design

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 tstkit 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 ensuring.

Installation

To install CTX42 Testing Module, use go get:

go get github.com/ctx42/testing

This will make all the package modules available to you.

Packages

Main Packages

Packages used in test cases.

  • Package assert provides assertion toolkit.
  • Package check provides equality toolkit used by assert package.
  • Package goldy provides basic golden file support.
  • Package mock package provides primitives for writing interface mocks.
  • Package must provides basic test helpers which panic on error.
Infrastructure Packets

Packages used to create custom checks, assertions and helpers.

  • Package dump provides configurable renderer of any type to a string.
  • Package notice helps to create nicely formated 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.

Directories

Path Synopsis
Package examples provides usage examples for testing module.
Package examples provides usage examples for testing module.
internal
affirm
Package affirm is an internal package that provides simple affirmation functions designed to improve readability and minimize boilerplate code in test cases by offering concise, semantically meaningful functions.
Package affirm is an internal package that provides simple affirmation functions designed to improve readability and minimize boilerplate code in test cases by offering concise, semantically meaningful functions.
constraints
Package constraints defines a set of useful constraints to be used with type parameters.
Package constraints defines a set of useful constraints to be used with type parameters.
core
Package core provides foundational utilities for the Go Testing Module, offering low-level functions and types to support readable and robust test cases.
Package core provides foundational utilities for the Go Testing Module, offering low-level functions and types to support readable and robust test cases.
types
Package types provides example types used in tests.
Package types provides example types used in tests.
pkg
Package pkg gathers all CTX42 Test Module packages.
Package pkg gathers all CTX42 Test Module packages.
assert
Package assert provides assertion functions.
Package assert provides assertion functions.
check
Package check provides equality toolkit used by assert package.
Package check provides equality toolkit used by assert package.
dump
Package dump can render string representation of any value.
Package dump can render string representation of any value.
mock
Package mock provides helpers for creating and testing with interface mocks.
Package mock provides helpers for creating and testing with interface mocks.
must
Package must provide a set of helper functions which panic on error.
Package must provide a set of helper functions which panic on error.
notice
Package notice simplifies building structured assertion messages.
Package notice simplifies building structured assertion messages.
tester
Package tester provides structures to help with testing custom assertions and test helpers.
Package tester provides structures to help with testing custom assertions and test helpers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL