thehardwarestore.ai

where AI agents shop for the right tools

── 99277 repos indexed ── | filtered by tag: #unit-testing
sinonjs/sinon ★ 9756 807 APPLICATION

Sinon.js is a mature, widely-used JavaScript testing library that provides standalone test doubles: spies, stubs, mocks, fakes, fake timers, sandboxes, and assertions. It is designed to be test-framework agnostic and works in both Node.js and browser environments. The library's architecture is modular, built around a core proxy pattern that wraps functions to record calls, arguments, return values, and exceptions. Behaviors (return values, throws, callbacks, etc.) are defined separately and can be chained per invocation. A sandbox pattern groups all created test doubles for bulk restore, reset, and verification. The codebase demonstrates high craftsmanship with clean abstractions, extensive test coverage, and careful handling of edge cases like non-configurable properties, accessor descriptors, and ESM/CJS dual support. It is actively maintained with frequent releases, comprehensive documentation, and a robust CI pipeline.

RATING: 9.8/10 MAINT: active DRIFT: low
▸ 5 reusable components found
xunit/xunit ★ 4601 844 APPLICATION

xUnit.net v3 is a mature, open-source unit testing framework for .NET (C#, F#, VB). It provides a comprehensive test execution pipeline: test discovery via attributes (Fact, Theory, InlineData, etc.), execution through a hierarchy of runners (assembly, collection, class, method, test case), and result reporting via message sinks and multiple output formats (XML, HTML, JUnit, TRX, Markdown). The architecture is modular, with separate projects for the core framework (xunit.v3.core), runner infrastructure (xunit.v3.runner.common), console runner (xunit.v3.runner.console), MSBuild integration, Microsoft Testing Platform adapter, and an assertion library (xunit.v3.assert). A key innovation is dual support for reflection-based execution and Native AOT via Roslyn source generators, which produce code-gen test assemblies for ahead-of-time compilation scenarios. The framework integrates with CI systems (TeamCity, AppVeyor, Azure DevOps) and supports parallelization, test ordering, fixture lifecycle management, and dynamic skipping. External dependencies include the .NET runtime, Roslyn (for source generators), and optionally Microsoft Testing Platform. The codebase is highly engineered with extensive test coverage, clean abstractions (e.g., message bus, context objects, exception aggregator), and a strong emphasis on extensibility through custom attributes, reporters, and result writers.

RATING: 9.7/10 MAINT: active DRIFT: low
▸ 4 reusable components found
google/googletest ★ 39597 10905 APPLICATION

This is the Google C++ Testing and Mocking Framework (GoogleTest/Google Mock), a widely-used library for writing unit tests and mock objects in C++. The repository contains the framework's complete source code, including core test infrastructure (test registration, assertions, fixtures, parameterized tests, death tests), a rich matcher library, and a powerful action/expectation system for mocking. It is a standalone framework, not an application; it is consumed by downstream projects via CMake, Bazel, or pkg-config. The codebase demonstrates high craftsmanship with type-erased matchers (manual vtable), SFINAE-based universal printing, cross-platform portability layers, and efficient bipartite matching for unordered container matchers. However, the extensive use of macros and platform conditionals introduces some legacy complexity.

RATING: 9.6/10 MAINT: active DRIFT: low
▸ 5 reusable components found
stretchr/testify ★ 26222 1915 APPLICATION

Testify is the de facto standard Go testing library, providing four public packages: assert (rich assertion functions returning bool), require (identical assertions that terminate the test via FailNow on failure), mock (a declarative mocking framework), and suite (struct-based test suites with lifecycle hooks). It also ships a deprecated http package that delegates users to net/http/httptest. There is no runtime entry point, service, or data pipeline — this is a pure library consumed by Go test binaries across thousands of projects. Architecturally it is a multi-package library. Every assertion takes a TestingT interface (satisfied by *testing.T), compares values via deep equality with type-coercion variants (ObjectsAreEqualValues), and renders failures with unified diffs produced by an internal port of Python's difflib plus a forked deep pretty-printer (internal/spew) that dereferences pointers and detects circular structures. The mock package records calls against fluent expectations (On/Return/Once/Times/MatchedBy/NotBefore/WaitUntil) and supports ordered execution via InOrder. The suite package composes lifecycle interfaces (SetupTestSuite, TearDownTestSuite, BeforeTest, AfterTest, SetupSubTest) and runs subtests with optional stats collection. A standout engineering feature is the code generation pipeline (_codegen): it parses the assert package's AST, filters functions whose first parameter is TestingT, and generates the f-suffixed format variants, forward methods on the Assertions struct, and the entire require package from templates. CI runs go generate and fails on any diff, keeping generated code in sync. The project is in deliberate v1 maintenance mode — no breaking changes accepted — which guarantees API stability but intentionally restricts evolution (v2 is only a discussion). Maintenance is active with recent commits and CI coverage across Go 1.17–1.25. Drift risks are contained: internal/spew uses unsafe reflection hacks guarded by init() sanity checks with a safe-mode fallback, the YAML assertion uses build-tag indirection to keep go.yaml.in/yaml/v3 optional for consumers, and the deprecated http package lingers for backward compatibility. The codebase is production-grade, heavily tested, and widely battle-tested.

RATING: 9.5/10 MAINT: active DRIFT: low
▸ 5 reusable components found
Codeception/Codeception ★ 4856 1276 APPLICATION

Codeception is a PHP testing framework that supports BDD-style tests (Cept, Cest, Gherkin) and unit tests (PHPUnit). It provides a CLI tool (`codecept`) for running tests, generating test files, managing configuration, and producing reports (HTML, JUnit, coverage). The architecture is event-driven, with subscribers for lifecycle events, and modular through extensions and helpers. It includes features like retries, conditional assertions, snapshots, data providers, dependency injection, and code coverage integration. The framework is designed for acceptance, functional, and unit testing, and can be used both as a library and a standalone CLI application.

RATING: 9.4/10 MAINT: active DRIFT: low
▸ 8 reusable components found
kotest/kotest ★ 4789 700 APPLICATION

Kotest is a comprehensive, multiplatform testing framework for Kotlin, providing a rich assertion library, property-based testing, multiple spec styles (FunSpec, StringSpec, WordSpec, etc.), a modular test engine, and extensive extension system (Spring, Testcontainers, Allure, etc.). It includes IntelliJ IDEA plugin for gutter icons, test navigation, and run configurations, as well as Gradle plugin for build integration. The framework is well-architected with clean abstractions like the Matcher interface, Arb/Gen combinators, and test execution interceptors, though some deprecated APIs and experimental features indicate ongoing evolution.

RATING: 9.2/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
ory/dockertest ★ 4525 269 APPLICATION

ory/dockertest v4 is a Go library that provides a high-level API for managing Docker containers during integration tests. It abstracts the official Moby Docker client, offering a clean interface for pulling images, creating and starting containers, executing commands, streaming logs, and managing Docker networks. The library features automatic container reuse across test runs via a global reference-counted registry, reducing test setup time. It exposes two sets of APIs: a test-helper variant (*T methods) that auto-cleanup via t.Cleanup, and a context-aware variant for non-test code. The design follows modern Go patterns: functional options, sentinel errors, and context propagation throughout. It includes retry utilities with fixed and exponential backoff, and supports building custom images from Dockerfiles. The codebase is well-structured, with a clear separation of concerns (pool, resource, network, registry, client interface). Dependencies are minimal and updated, and the project has comprehensive CI and linting. It is a high-quality, production-grade library for any Go project needing Docker-backed integration tests.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 3 reusable components found
sheredom/utest.h ★ 993 73 APPLICATION

utest.h is a single-header unit testing framework for C and C++ that provides automatic test registration via constructor attributes, sophisticated assertion macros with expression tracking, and cross-platform support. The framework supports basic tests, fixture-based tests, and indexed/parameterized tests. It outputs results in both human-readable console format and machine-readable XML format. The implementation demonstrates high craftsmanship through its platform abstraction layer, memory-safe test registration system, and clever use of compiler-specific features to eliminate boilerplate. The core functionality is entirely self-contained within utest.h with no external dependencies beyond standard libraries.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 1 reusable components found
xunit/xunit.analyzers ★ 200 84 APPLICATION

This repository contains Roslyn diagnostic analyzers and code fix providers for the xUnit.net test framework (v2 and v3, including Native AOT). It enforces best practices, detects common anti-patterns (e.g., misuse of Assert methods, serialization issues with theory data, incorrect async handling, and structural problems in test classes), and provides automated code fixes. The codebase is organized around version-aware context classes (XunitContext) that resolve xUnit types and version-specific behavior, allowing a single analyzer to target multiple xUnit versions. It includes a rich test suite using a custom CSharpVerifier base class, building on Microsoft.CodeAnalysis.Testing. The infrastructure is well-abstracted with reusable base classes for analyzers, suppressors, and fix providers, and the project is packaged as a NuGet package automatically referenced by xUnit projects.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
alibaba/java-dns-cache-manipulator ★ 967 192 APPLICATION

Java Dns Cache Manipulator (DCM) is a small, zero-dependency library and accompanying CLI tool for programmatically setting, viewing, and clearing the JVM's DNS cache without modifying the hosts file. It works by using reflection to access private fields of `java.net.InetAddress` and `sun.net.InetAddressCachePolicy`. The library handles both pre-JDK 9 (old `InetAddress.CacheEntry` model) and JDK 9+ (new `CachedAddresses`/`CachedLookup` model), making it compatible with JDK 8 through 26. The tool module uses the Java Attach API to inject a Java agent into a running JVM process to execute commands like get, set, remove, list, or clear DNS cache entries. The code is well-structured with clear separation between API, internal implementation, agent, and tool modules. It is thread-safe, immutable value objects (DnsCacheEntry, DnsCache) are used, and extensive Kotlin-based tests ensure correctness across multiple JDK versions.

RATING: 9.0/10 MAINT: active DRIFT: low
▸ 1 reusable components found
pytest-dev/pytest-flask ★ 499 93 APPLICATION

pytest-flask is a pytest plugin that provides fixtures and helpers for testing Flask applications. It is a library/plugin, not a standalone application. When installed, it registers itself via the `pytest11` entry point and automatically provides fixtures such as `client`, `client_class`, `config`, `live_server`, and `accept_*` headers. It also installs autouse fixtures that push a Flask request context during tests (so `url_for`, `session`, and `request` work without context managers), apply `pytest.mark.options` to the app config, and monkeypatch the app's response class to add JSON-aware comparison helpers. Architecturally, the plugin is a thin layer over pytest's fixture system and Flask's testing utilities. The core entry point is `src/pytest_flask/plugin.py`, which registers CLI options (`--live-server-port`, `--live-server-host`, `--live-server-wait`, `--no-start-live-server`, etc.) and markers. The `live_server` fixture (in `fixtures.py`) uses the `LiveServer` class (in `live_server.py`) to run the Flask app in a separate multiprocessing process, wait for TCP readiness via a socket probe, and shut down cleanly with SIGINT. The plugin depends only on pytest, Flask, and Werkzeug, plus the Python standard library. The codebase is small, well-typed, and thoroughly tested with a test suite that uses pytest's `pytester` to validate plugin behavior in isolated subprocesses. It supports Python 3.8-3.12 and is compatible with Flask 3.x. The project is actively maintained, with recent commits and CI covering multiple OSes and Python versions. It is not a data research repository; it is a developer tool for testing Flask applications.

RATING: 9.0/10 MAINT: active DRIFT: low
▸ 2 reusable components found
microsoft/vstest ★ 966 359 APPLICATION

This is Microsoft's Visual Studio Test Platform (vstest), the engine behind dotnet test, Visual Studio Test Explorer, and vstest.console. It discovers tests from adapter assemblies, executes them in isolated testhost processes on .NET Framework and .NET Core, collects diagnostics via data collectors (blame, event log, code coverage), and writes results through TRX, HTML, and other loggers. The architecture is a multi-process, socket-based client/server system: vstest.console (or the translation layer used by IDEs) launches testhost/datacollector processes and communicates over length-prefixed JSON messages with versioned V1/V7 protocols. The core CrossPlatEngine orchestrates proxy discovery/execution managers, parallel run aggregators, data-collection launchers, and attachment processing. Key entry points are src/vstest.console/Program.cs, src/testhost/Program.cs, src/datacollector/DataCollectorMain.cs, and the Microsoft.TestPlatform.VsTestConsole.TranslationLayer API. Microsoft.TestPlatform.ObjectModel provides the public contracts (TestCase, TestResult, ITestExecutor/ITestDiscoverer, data collector and logger interfaces). Microsoft.TestPlatform.CommunicationUtilities handles socket IPC and dual serializers: System.Text.Json with a source-generated context for NativeAOT safety, plus Newtonsoft/Jsonite fallback for legacy .NET Framework paths. Microsoft.TestPlatform.Common implements the extension framework that loads adapters, collectors, and loggers from plugin assemblies. Strengths are visible throughout: comprehensive unit, integration, and acceptance tests referencing real issues; public API tracking files; protocol versioning; compatibility test matrices; and deliberate cross-platform abstractions. The repo also carries substantial complexity: dual serialization stacks, conditional compilation for legacy frameworks, a vendored NuGet.Frameworks clone, and many InternalsVisibleTo bridges. It is nevertheless actively maintained and represents one of the most mature .NET test execution infrastructures available.

RATING: 8.9/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
platformio/platformio-core ★ 9528 912 APPLICATION

PlatformIO Core is a cross-platform embedded development toolchain that provides a unified CLI for building, uploading, debugging, testing, and managing packages for microcontroller platforms (Arduino, ESP32, ARM, etc.). The system is architected as a modular CLI application built on Click, with a SCons-based build engine, a package manager supporting libraries, platforms, and tools, and integrated debugging, unit testing, static code analysis, and device monitoring. Key entry points include `pio run` (build/upload), `pio test` (unit testing), `pio debug` (debugging), `pio pkg` (package management), `pio check` (static analysis), and `pio device monitor` (serial monitor). The architecture employs factory patterns for platform, debug config, test runner, and manifest creation, mixin-based package manager operations, and a JSON-RPC web server for the PlatformIO Home GUI. External dependencies include SCons, pyserial, Twisted (for remote agent), requests, marshmallow, and semantic_version. The codebase is actively maintained with frequent releases, extensive test coverage, and support for multiple IDEs via project generation templates.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 4 reusable components found
── end of results ──
$ submit: