Manual exploratory – discovering the unexpected
In this section, we will appreciate the role of manual exploratory testing as an important line of defense against defects where TDD is used.
The biggest threat to our success with TDD lies in our ability to think about all the conditions our software needs to handle. Any reasonably complex piece of software has a huge range of possible input combinations, edge cases, and configuration options.
Consider using TDD to write code to restrict the sales of a product to buyers who are 18 years old and above. We must first write a happy-path test to check whether the sale is allowed, make it pass, then write a negative test, confirming that the sale can be blocked based on age. This test has the following form:
public class RestrictedSalesTest { @Test void saleRestrictedTo17yearOld() { // ... test code omitted ...