Unit test
A unit test is an automated test that checks whether a relatively small unit of software behaves as expected, typically in isolation from external dependencies.
Pro ASP.NET Core 7, Tenth Edition
A unit test is an automated test that checks a small, isolated part of an application such as an individual method or class.
- How it is used
- Checks isolated ASP.NET Core component behavior, from model properties to controller actions and tag-helper output.
- How deep it goes
- Works through project setup, assertions, runners, dependency isolation, and application tests; defers detailed explanation of ViewResult.
- Examples
- Uses product-property checks, controller view models, generated page links, category counts, and checkout decisions.
- What you can do after
- Apply it via xUnit and Moq to run isolated tests and check controller results and dependency calls.
Read how Pro ASP.NET Core 7, Tenth Edition explains unit test →
Shipping Go: Develop, deliver, discuss, design, and go again
Unit testing evaluates individual units of code independently and focuses on a small portion of a program.
- How it is used
- Provides fast, automated validation of small code units and documents expected business behavior during development.
- How deep it goes
- Works through selecting cases, asserting results, repairing failures, and refactoring; distinguishes unit tests from broader tests without developing full end-to-end testing.
- Examples
- Tests a Go translation function for supported languages, unsupported input, capitalization, and whitespace; also suggests deterministic balance and error-rate calculations.
- What you can do after
- Build it from scratch: write Go function tests, use failures to correct behavior, and automate the checks before broader testing.
Read how Shipping Go: Develop, deliver, discuss, design, and go again explains unit test →
BDD in Action, Second Edition
Unit testing is the evaluation of individual software components in isolation from the rest of the application.
- How it is used
- Uses unit tests to specify component behavior during outside-in feature implementation and to pinpoint code affected by changing requirements.
- How deep it goes
- Defines unit tests against acceptance tests and works through test-driven implementation and change; does not require one particular testing tool.
- Examples
- Shows a bank account’s initial-balance assertion and a journey planner test updated to expect four departures.
- What you can do after
- Apply it via JUnit 5 to specify component behavior and leave readable technical documentation for maintainers.
Spring Start Here, Second Edition
A unit test checks the behavior of a small, isolated unit of code.
- How it is used
- Uses unit tests to validate isolated Spring application logic and provide fast feedback as code changes.
- How deep it goes
- Works through assumptions, execution, and validation, including mock setup, interaction verification, returned values, and exception flows.
- Examples
- Tests money transfer balances and a missing account, plus successful and failed login controller actions.
- What you can do after
- Apply unit testing via JUnit and Mockito to control dependencies and verify method behavior.
Read how Spring Start Here, Second Edition explains unit test →
Rust Servers, Services, and Apps
A unit test is an automated test that checks the behavior of a small, isolated program component.
- How it is used
- Checks Rust web-service handlers and HTTP data-processing functions while building and testing application iterations.
- How deep it goes
- Works through test setup, direct invocation, and assertions; contrasts direct handler tests with integration tests but does not develop database logic in the interim example.
- Examples
- Uses course API handlers, tutor form submissions, HTTP request parsing, and response status and serialization assertions.
- What you can do after
- Evaluate handler behavior by invoking functions directly and asserting responses, or test HTTP parsing and response formatting with Cargo.
Read how Rust Servers, Services, and Apps explains unit test →
Clean Applications with Hexagonal Architecture
A testing technique that verifies small units of software in isolation from their dependencies.
- How it is used
- Uses isolated behavioral checks to complement structural rules in a hexagonal application.
- How deep it goes
- Provides repeatable recipes and testing exclusions, while deferring framework-integration concerns such as transaction boundaries and caching advice.
- Examples
- Uses command validation, mocked handler ports, REST controller responses, and technology-specific adapter tests.
- What you can do after
- Practice writing isolated tests for commands, queries, handlers, controllers, and adapters using responsibility-specific recipes.
Read how Clean Applications with Hexagonal Architecture explains unit test →
Practical Automation with PowerShell: Effective scripting from the console to the cloud
A unit test is a software test that verifies the behavior of a small, isolated unit of code.
- How it is used
- Uses repeatable Pester checks to protect PowerShell function logic as automation changes.
- How deep it goes
- Explains Pester structure, setup scope, mocks, assertions, and the unit-versus-integration boundary through complete scenarios.
- Examples
- Demonstrates patch-status checks and KB supersedence parsing with mocked cmdlets, web responses, HTML fixtures, GUIDs, products, and architectures.
- What you can do after
- Apply it via Pester to isolate PowerShell functions, control dependencies with mocks, and validate expected results.
Testing Spring Boot Applications
A test that isolates a small piece of code, such as a class or method, to verify its behavior independently.
- How it is used
- Uses isolated tests to verify small pieces of business logic quickly before relying on broader integration tests.
- How deep it goes
- Explains isolation, collaborators, assertions, and trade-offs, but stops short of full application-context or system verification.
- Examples
- Demonstrates a WeatherScoringService test using weather history, user preferences, mocked collaborators, a score call, and an assertion.
- What you can do after
- Apply it via focused JUnit tests that exercise complex service behavior without starting Spring Boot.
Read how Testing Spring Boot Applications explains unit test →
Test Driven: Practical TDD and Acceptance TDD for Java Developers
Unit testing is the practice of checking individual units of code, typically in isolation.
- How it is used
- Uses unit tests to drive implementation in TDD and provide feedback during development.
- How deep it goes
- Defines isolation criteria and works through test-driving a DAO, while contrasting unit tests with integration and acceptance tests.
- Examples
- Uses a DAO with three persistence technologies and contrasts its isolated tests with integration tests against an in-memory database.
- What you can do after
- Apply unit tests and test doubles to drive data-access code, alongside integration tests where broader coverage is needed.
Read how Test Driven: Practical TDD and Acceptance TDD for Java Developers explains unit test →
Vibe Engineering
A unit test evaluates an isolated software unit, such as a function or class, against expected behavior.
- How it is used
- Uses isolated assertions to verify core behavior, support regression checking, and provide a baseline during generated-code and legacy-system changes.
- How deep it goes
- Explains behavioral contracts and correlated blind spots through parser tests, but stops short of exhaustive specification or correctness proof.
- Examples
- Demonstrates parser assertions, nested-formatting failures, and database-save regression coverage during member registration.
- What you can do after
- Diagnose/debug with focused assertions, express required behavior as contracts, and catch regressions before broader integration checks.
gRPC Microservices in Go
A unit test verifies the behavior of an isolated unit of software, often across defined execution scenarios.
- How it is used
- Checks Order service scenarios quickly without running its dependent services.
- How deep it goes
- Works through interface mocks and success and failure assertions; leaves real database interaction to integration tests.
- Examples
- Uses Go PlaceOrder tests for successful placement, database persistence failure, and payment validation errors.
- What you can do after
- Build it from scratch for an Order service operation using mocked dependencies, then run tests and generate coverage.
Build High Value Software Systems
An automated test that verifies the behavior of a small isolated unit of software.
- How it is used
- Uses fast feedback to constrain behavior and contain defects in business logic.
- How deep it goes
- Defines speed, stability, and behavioral focus, and places unit tests within risk-based test layers.
- Examples
- Uses a shipping-cost calculation and business-rule testing to illustrate unit-level checks.
- What you can do after
- Apply test-first checks to specify business behavior and select unit tests for suitable risks.
Read how Build High Value Software Systems explains unit test →
The Creative Programmer
A unit test is an automated test that verifies the behavior of a small, isolated unit of software.
- How it is used
- Uses focused executable checks to verify assumptions, protect changes, and build confidence in difficult codebases.
- How deep it goes
- Explains the verification purpose and readable assertion pattern, but stops short of detailed test design or framework instruction.
- Examples
- Shows PL/SQL testing, a VB6 SimplyVBUnit suite, and a readable assertion expecting 45 from a method call.
- What you can do after
- Diagnose/debug with it by checking behavior, exposing false assumptions, and increasing confidence before committing changes.
Data-Oriented Programming in Java
A unit test is an automated check that evaluates a relatively small, isolated unit of software behavior.
- How it is used
- Uses isolated behavior checks to explore software state spaces without involving real dependencies.
- How deep it goes
- Defines isolation, mocks, strengths, and limitations, then defers dependency behavior to integration tests.
- Examples
- Demonstrates generated account sets at ten, 1,000, and 1,000,000 items while retaining the same test.
- What you can do after
- Evaluate isolated behavior deeply, vary test states, and recognize when integration testing is needed.
Read how Data-Oriented Programming in Java explains unit test →
Google Anthos in Action
Unit testing is the practice of testing an isolated software unit, such as a function, class, or module, against expected behavior.
- How it is used
- Uses automated checks in continuous integration to accelerate legacy-application modernization and provide developers with rapid feedback.
- How deep it goes
- Defines isolated testing and its CI role, but stops short of detailing test design, execution mechanics, or assertion strategies.
- Examples
- Tests a decoupled business-domain service in isolation as part of an application build pipeline.
- What you can do after
- Apply unit tests through continuous integration to identify and fix application problems faster.
Essential TypeScript 5, Third Edition
A unit test is an automated test that evaluates a small, isolated unit of program behavior.
- How it is used
- Confirms that application code behaves as expected, especially for features and functions likely to contain deployment bugs.
- How deep it goes
- Explains setup, file conventions, assertions, watch execution, and failure correction, but stops short of teaching unit-testing theory.
- Examples
- Uses a calc.test.ts file to test sum, Jest matchers, watch output, and deliberate implementation and expectation changes.
- What you can do after
- Apply it via Jest to write, execute, monitor, and diagnose focused tests for TypeScript application behavior.
Read how Essential TypeScript 5, Third Edition explains unit test →
Microservices Patterns, Second Edition
A unit test verifies a small, isolated unit of software behavior, typically executing quickly within a local development environment.
- How it is used
- Accelerates change validation by checking isolated behavior without heavyweight infrastructure.
- How deep it goes
- Defines in-memory tests for non-trivial code and distinguishes them from adapter integration tests and whole-module tests.
- Examples
- Tests an Order entity, algorithms, and dependency-free business logic in memory.
- What you can do after
- Evaluate non-trivial code behavior in memory without relying on heavyweight infrastructure services.
Read how Microservices Patterns, Second Edition explains unit test →
The Cloud at Your Service: The when, how, and why of enterprise cloud computing
A test that checks an individual unit of software, such as a function or component, in isolation.
- How it is used
- Uses automated checks of internal algorithms as one part of software testing and development.
- How deep it goes
- Defines the test type and discusses setup, runtime, parallel execution, and CI capacity without detailing test implementation.
- Examples
- Names JUnit, NUnit, and xUnit equivalents for testing internal algorithms and code.
- What you can do after
- Operate/configure test-framework parallelization to use idle CPU cores and potentially shorten execution, while accounting for CI queues.
Also covered in
- Rust Web Development
- Go in Action, Second Edition
- Claude at WorkIn early access (MEAP)
- Java Persistence with Spring Data and Hibernate epub
- Regular Expression Puzzles and AI Coding Assistants
- Delivering Machine Learning Projects: From design to deployment
- Functional Programming in C#, Second Edition
- Building LLM Applications with DSPy
- Secrets of the JavaScript Ninja, Third EditionIn early access (MEAP)
- Web Component Development with Modern Libraries and ToolingIn early access (MEAP)
- Grokking Software ArchitectureIn early access (MEAP)
- The Well-Grounded Python Developer: How the pros use Python and Flask
What to know first
- integration testAn integration test evaluates whether multiple software components, or a component and an external dependency, interact and behave correctly together.
- containerA software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
- software testingSoftware testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
- test-driven developmentTest-driven development is a software development practice in which tests specify expected behavior and guide incremental implementation, typically being written before the corresponding code.
Related concepts
- integration testcontrasts with · An integration test evaluates whether multiple software components, or a component and an external dependency, interact and behave correctly together.
- mockinguses · Mocking is a testing technique that replaces a dependency or collaborator with a controlled substitute to simulate behavior, isolate code, or inspect interactions.
- test doubleuses · A test double is a substitute for a real dependency or collaborator that provides controlled behavior or enables interaction observation during testing.
- pure functioncontrasts with · A pure function is a function whose result depends only on its explicit inputs and whose evaluation has no externally observable side effects.
- test-driven developmentused by · Test-driven development is a software development practice in which tests specify expected behavior and guide incremental implementation, typically being written before the corresponding code.
Questions about unit test
What is unit test?
A unit test is an automated test that checks whether a relatively small unit of software behaves as expected, typically in isolation from external dependencies.
Which Manning books explain unit test?
Pro ASP.NET Core 7, Tenth Edition, Shipping Go: Develop, deliver, discuss, design, and go again, BDD in Action, Second Edition, Spring Start Here, Second Edition, Rust Servers, Services, and Apps, Clean Applications with Hexagonal Architecture, Practical Automation with PowerShell: Effective scripting from the console to the cloud, Testing Spring Boot Applications and 10 more.
What should I know before learning unit test?
Manning books that teach unit test usually introduce integration test, container, software testing and test-driven development first.
What is the difference between unit test and integration test?
A unit test is an automated test that checks whether a relatively small unit of software behaves as expected, typically in isolation from external dependencies. An integration test evaluates whether multiple software components, or a component and an external dependency, interact and behave correctly together.
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.

















