liveBook · Manning

Testability

As explained in Spring Start Here, Second Edition

Testability is the degree to which software can be tested effectively and efficiently.

Testability is how effectively and efficiently software can be tested. Designing for testability also supports maintainability: focused tests check whether a method produces expected results, while repeated testing helps catch broken functionality. section 15.1

Testing a money transfer

A transfer method looks up two accounts, calculates their new balances, and updates them. Identify relevant scenarios for that logic, then write a test method for each in a test class. section 15.1

Figure 15.3 For any piece of logic you test, you need to find the relevant test scenarios. For each test scenario, you write a test method in a test class. You add the test classes in the app’s Maven project test folder. In this figure, the TransferMoneyUnitTests class is a test class that contains the test scenarios for the transferMoney() method. TransferMoneyUnitTests defines multiple test case methods to test each relevant scenario in the transferMoney()’s method logic.

See how a test class groups separate test methods for the scenarios of one transfer method. section 15.1

How Spring Start Here, Second Edition covers it

How deep it goes
Defines method-focused tests, scenario-specific test methods, and CI execution, but does not detail test implementation or assertions.
Examples
Uses a money-transfer method, its account lookup and update steps, and separate test methods for relevant scenarios.
What you can do after
Build it from scratch by identifying method scenarios and writing a test method for each in a test class.
How it connects
Links testability to maintainability, unit testing, and continuous integration.

Also explained in

Compare how 7 books explain testability →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.