liveBook · Manning

System under test

As explained in Testing Spring Boot Applications

The application under test is the software system whose behavior is being verified by a test.

The system under test is the application whose behavior a test verifies. In Spring Boot testing, it can range from a focused application slice to the full application, depending on how much context the test needs. section 1.6 section 2.1

With @SpringBootTest, Spring Boot detects the application configuration, prepares a test-oriented application context, starts the application before tests, and shuts it down with cleanup afterward. Tests can access beans with @Autowired, inspect repository state, change properties, or replace beans with stubs and mocks. section 1.6 section 3.0

Choose the test subject and application context deliberately:

  • Use a full application context for user scenarios that exercise the application end to end within the test environment. section 1.6
  • Prefer a narrower or more focused setup for fine-grained conditional logic and tests containing substantial state. section 1.6
  • Customize the application under test when external services need stubbing, profiles need separation, or only selected modules should load. section 3.0

Weather dashboard

A sample application under test displays weather and temperature for user-selected cities. Its controller receives requests, application classes hold the logic, and external weather services provide data. It can use the live Open-Meteo API or a local profile with a fake API that returns random weather, allowing tests to avoid the external dependency. section 2.1

Figure 2.2 The architecture of the application under test. On the left side, the @Controller is the entrypoint to the application. On the right side are external systems that the application connects to. In between are the classes that hold your application logic. Solid arrows represent code dependencies and dashed arrows external connections.
ch02 f02 garniermoiroux

Use the architecture diagram to trace the controller entry point, application logic, and external connections that together define the test subject. section 2.1

How Testing Spring Boot Applications covers it

How deep it goes
Defines the test subject and lifecycle, then stops short of prescribing one universal context size.
Examples
Uses a weather dashboard, Open-Meteo integration, local fake API, controller, repositories, and application architecture.
What it assumes
Assumes an application exists to test, while establishing the application boundary and its relevant external dependencies.
What you can do after
Operate/configure a Spring Boot application context and select suitable real, stubbed, or mocked dependencies for tests.
How it connects
Connects integration tests with unit tests, end-to-end tests, application contexts, profiles, and dependency mocking.

Also explained in

Compare how 5 books explain system under test →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Testing Spring Boot Applications. The section links point to the parts of the book it draws on.