Skip to content
testcritic

Unit & Component Testing

Fast feedback on individual functions and components, in milliseconds.

17 specialist tools17 free or open source17 self-hostable

What this category is really about

Unit tests are the base of the pyramid: cheap to write, near-instant to run, and precise about what broke. Component tests sit just above, rendering a single UI component in isolation and asserting on what a user would see.

Choice here is mostly determined by your language and build tooling. The interesting decision is not which assertion library but how much of your stack you mock — over-mocking produces suites that pass while production burns.

What to evaluate

01

Watch-mode speed

Sub-second re-runs on save are the entire point. Anything slower and developers stop running tests locally.

02

Build-tool alignment

A runner that shares your bundler's transform pipeline avoids a second, divergent config to maintain.

03

Coverage reporting

Native coverage that plugs into your CI's quality gate, rather than a bolted-on second tool.

04

Mocking ergonomics

Module mocking, timers, and network interception should be first-class, not community plugins.

Common mistakes

  • Chasing a coverage percentage instead of covering the risky code.
  • Mocking the thing you are actually trying to test.
  • Writing component tests that assert on implementation details (class names, internal state) and break on every refactor.

17 tools built for this

Sorted by how widely adopted they are, not by preference. Tick the compare boxes to put two or more side by side.

Filter these

Jest

The JavaScript testing incumbent: batteries included, snapshots, huge ecosystem.

Open sourceSelf-host

JUnit 5

The Java testing standard, rebuilt with extensions and parameterised tests.

Open sourceSelf-host

PHPUnit

The PHP testing standard, integrated into every major PHP framework.

Open sourceSelf-host

pytest

The de facto Python testing framework: fixtures, parametrisation, plugins.

Open sourceSelf-host

Storybook

Build components in isolation, then test the stories you already wrote.

Open sourceSelf-host

Testing Library

Query the DOM the way a user would, not the way the framework does.

Open sourceSelf-host

Vitest

Vite-native test runner with instant watch mode and a Jest-compatible API.

Open sourceSelf-host

xUnit.net

The modern .NET testing framework, and the one Microsoft's templates default to.

Open sourceSelf-host

Mocha

Minimal, unopinionated Node.js test runner you assemble to taste.

Open sourceSelf-host

NUnit

The long-standing .NET test framework with the richest assertion set.

Open sourceSelf-host

Pest

A friendlier front end for PHPUnit with a function-based, expressive API.

Open sourceSelf-host

RSpec

Ruby's behaviour-driven testing framework with an exceptionally readable DSL.

Open sourceSelf-host

TestNG

Java test framework built for suite configuration, grouping and data providers.

Open sourceSelf-host

unittest

Python's standard-library xUnit framework. Always there, never exciting.

Open sourceSelf-host

AVA

Concurrent Node.js test runner that isolates every file in its own process.

Open sourceSelf-host

Jasmine

Behaviour-driven JavaScript testing framework with no external dependencies.

Open sourceSelf-host

node:test

Node.js's built-in test runner. Zero dependencies, already installed.

Open sourceSelf-host

Tools that also cover this

These are built primarily for something else but handle this category as part of a broader platform — often a way to consolidate two subscriptions into one.