Skip to Content
Spring Boot: Up and Running
book

Spring Boot: Up and Running

by Mark Heckler
February 2021
Intermediate to advanced content levelIntermediate to advanced
325 pages
8h 15m
English
O'Reilly Media, Inc.
Book available
Content preview from Spring Boot: Up and Running

Chapter 9. Testing Spring Boot Applications for Increased Production Readiness

This chapter discusses and demonstrates core aspects of testing Spring Boot applications. While the subject of testing has numerous facets, I focus upon the fundamental elements of testing Spring Boot applications that dramatically improve the production readiness of each application. Topics include unit testing, holistic application testing using @SpringBootTest, how to write effective unit tests using JUnit, and using Spring Boot testing slices to isolate test subjects and streamline testing.

Code Checkout Checkup

Please check out branch chapter9begin from the code repository to begin.

Unit Testing

Unit testing serves as a precursor to other types of application testing for good reason: unit testing enables a developer to find and fix bugs at the earliest possible stages of the develop+deploy cycle and as a result, to fix them at the lowest possible cost.

Simply put, unit testing involves validating a defined unit of code isolated to the maximum possible and sensible extent. A test’s number of outcomes increases exponentially with size and complexity; reducing the amount of functionality within each unit test makes each one more manageable, thus increasing the likelihood that all likely and/or possible outcomes are considered.

Only once unit testing is implemented successfully and sufficiently should integration testing, UI/UX testing, and so on be added to the mix. Fortunately Spring Boot incorporates ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Microservices with Spring Boot, Second Edition

Building Microservices with Spring Boot, Second Edition

Josh Long / Phillip Webb
Spring Boot Fundamentals

Spring Boot Fundamentals

Bharath Thippireddy

Publisher Resources

ISBN: 9781492076971Errata PageSupplemental Content