Unit Testing glossary

28 Unit Testing terms, from Novice to Master. Start with the basics or jump to a level.

Updated

Novice

Arrange, Act, Assert
Set up, do the action, check the result.
Assertion
A check that a result matches what you expect.
Passing and Failing Tests
Green means expected behaviour; red shows what broke.
Test Case
One specific scenario being checked.
Test Runner
The tool that finds, runs and reports tests.
Unit Test
A small automated check of one piece of code.

Apprentice

End-to-End Test
Tests the whole app like a user, often in a browser.
Integration Test
Checks that several parts work together for real.
Test Pyramid
Many unit tests, fewer integration tests, few end-to-end tests.
Test-Driven Development
Write a failing test first, then the code to pass it.

Journeyman

Code Coverage
How much code the tests execute.
Mock
A stand-in that records how it was called.
Red, Green, Refactor
The TDD loop: fail, pass, then tidy.
Setup and Teardown
Code run before and after each test.
Snapshot Testing
Save output at the beginning of a test, then check again later to see if the values changed.
Stub and Fake
Stubs return canned answers; fakes are simple working versions.
Test Double
Any stand-in object used in a test.
Test Naming
Names that state behaviour, condition and expected outcome.

Freelancer

Contract Test
Checks a service still matches its agreed contract.
Flaky Test
A test that passes or fails at random.
Locator
A way to find elements by role, label or text.
Playwright
A tool for automated end-to-end browser tests.
Property-Based Testing
Checking a rule against many generated inputs.
Test Isolation
Each test stands alone, independent of others.
Testcontainers
Real databases in throwaway Docker containers for tests.

Master

Approval Testing
Comparing output against an approved file.
Characterization Test
A test recording what existing code does today.
Mutation Testing
Deliberately breaking code to check tests notice.

More subjects in Programming Fundamentals