What you will learn in The Art of Unit Testing 3e
with examples in JavaScript
Chapter by chapter
Concepts explained in this book
- software testingAn individual executable test specification that exercises behavior and records whether it passes or fails.
- mockingA programmable test double that replaces an outgoing dependency and records or verifies interactions with it.
- database transactionThe complete sequence of actions between triggering an entry point and observing a noticeable end result through one or more exit points.
- stubA stub is a test double that replaces an incoming dependency by providing controlled behavior or data without verifying interactions with it.
- integration testTesting that verifies behavior across multiple integrated components or against external systems such as databases and networks.
- dependencyAn imported or required software component on which a module relies.
- exit pointAn observable result produced when a unit of work finishes, such as a returned value, state change, or interaction with an uncontrolled external system.
- trustConfidence that tests reliably reveal whether the covered functionality is working correctly.
- flaky testTest flakiness is the tendency of tests to produce inconsistent pass-or-fail results without a relevant code change.
- maintainabilityThe degree to which software or tests can be understood, modified, corrected, or evolved efficiently over time.
- entry pointAn externally triggerable function or interface through which execution of a unit of work begins.
- code readabilityThe quality of test code that determines how easily it can be read and understood.
- test-driven developmentA development technique in which a failing test is written before the production code that makes it pass, followed by refactoring or another test.
- dependency injectionA technique in which a component receives a value or behavior from outside rather than creating it internally.
- test doubleA test double is a replacement for a real dependency that provides simplified behavior or enables observation during a test.
- JestJest is a JavaScript testing framework that provides facilities for writing, running, and reporting tests.
- factoryA factory function is a function that creates and returns an object, value, or configured function.
- mocking frameworkA software framework that creates and configures test doubles and supports checking their interactions.
- mutable shared stateMutable data or external state that is accessible by multiple tests or software components.
- assertionAn assertion is a test condition that verifies whether an actual result or behavior satisfies an expected truth condition.
- beforeEachbeforeEach is a Jest lifecycle function that runs shared setup code before each test in a scope.
- real dependencyA dependency whose actual implementation or external state is used during a test rather than a controlled substitute.
- regressionA previously working software behavior that becomes broken after a change.
- refactoringRefactoring is changing the internal structure of code without changing its externally observable functionality.
- functional, stateless philosophyA programming paradigm that emphasizes function composition, expressions, and minimizing mutable state and side effects.
- end-to-end testingA system end-to-end test verifies behavior through the complete running system and its operational boundaries.
- test automation frameworkA software framework that provides infrastructure and APIs for defining, running, and reporting tests.
- false positiveA false positive, or false test failure, is a reported test failure even though the underlying production behavior is correct.
- antipatternAn antipattern is a commonly used approach that appears reasonable but produces undesirable consequences or problems.
- test nameThe textual name assigned to a test to communicate the tested unit, scenario, and expected behavior or exit point.
- high-level testA higher-level test verifies behavior across relatively broad system boundaries and typically involves multiple components or external interactions.
- scenarioA test scenario is a defined situation, set of inputs, or conditions under which software behavior is tested.
- seamA seam is a location in code where behavior or dependencies can be replaced for testing.
- return valueA return value is data produced by a function and delivered to its caller when the function completes.
- test recipeA test recipe is a prescribed sequence of setup, execution, and verification steps for running a test scenario.
- legacy codeOlder application source code that is difficult to change, test, or understand and may no longer be supported in its original environment.
- low-level testA low-level test verifies a smaller or more isolated unit of software behavior than a higher-level test.
- contractAn application programming interface is a defined set of operations and data contracts through which software components communicate.
- deployment pipelineAn automated workflow containing release-blocking tests and deployment steps that provides fast feedback and can authorize software release when successful.
- state transitionA state change is a modification to data or module state that can be observed by code outside the operation causing it.
- value-based testA test that verifies behavior by examining the value returned by the code under test.
- system under testA system under test is the subject, system, suite, component, class, or code being tested.
- assertion rouletteA testing anti-pattern in which multiple assertions are placed in one test so that an early failure prevents later assertions from being evaluated or reported.
- adapterAn adapter is a component that abstracts or translates an underlying dependency behind a replaceable interface.
- module injectionModule injection is a dependency-injection technique in which a module receives or imports replaceable collaborators through its module boundary.
- incoming dependencyAn incoming dependency is a dependency that supplies data or behavior to a unit of work without representing its eventual externally observable result.
- behaviorBehavior of software that can be detected through outputs, state changes, or other effects visible to an external observer.
- describeA Jest construct that groups related test cases under a named block for organization and readability.
- interfaceA contract that specifies the operations or behavior exposed by a software component or type.
- private memberA private method is a method accessible only within the class or component that defines it.
- Interface Segregation PrincipleThe interface segregation principle favors small, client-specific interfaces instead of forcing consumers to depend on broad interfaces.
- extract adapter patternA testability pattern that isolates an inherently asynchronous operation behind an abstraction so it can be replaced by synchronous behavior during testing.
- hexagonal architectureAn architectural pattern that isolates application logic behind ports and connects it to external systems through replaceable adapters.
- parameterized testingA parameterized test is a test whose logic runs repeatedly with different values drawn from a parameter set or table.
- outgoing dependencyA dependency through which a unit of work produces an external effect or reaches an exit point.
- abstractionA simplified boundary that hides implementation details while exposing a controlled interface to underlying behavior or dependencies.
- state-based testingA state-based test verifies behavior by examining the observable state produced or changed by the code under test.
- test isolationTest isolation is the property that each test runs independently without relying on or altering the state or execution of other tests.
- interaction testingA testing technique that verifies how a unit of work interacts with its outgoing dependencies, including the calls made and their parameters.
- object-oriented programmingA programming paradigm that structures software around objects encapsulating state and behavior.
- duck typingDuck typing is a type-compatibility approach that accepts an object based on the operations it supports rather than its declared type or class.
- test runnerSoftware that executes tests, reports their results, and proceeds between test cases according to its execution rules.
- arrange act assert patternThe Arrange-Act-Assert pattern structures a test into setup of test conditions, execution of the behavior under test, and verification of the outcome.
- async/awaitAsync/await is JavaScript syntax for expressing promise-based asynchronous control flow in a sequential-looking form.
- jest.mockA Jest API that replaces a specified imported or required module with an automatically generated or configured mock.
- fake loggerA lightweight logger test double that records supplied messages in accessible state instead of writing them to a real logging destination.
- constrained test orderConstrained test order is an antipattern in which a test depends on another test having executed or not executed first.
- expectationAn expectation is the behavior or result that a test predicts for a specified unit and scenario.
- parallel test executionParallel test execution is the concurrent execution of multiple tests to reduce total test execution time.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
