The art of unit testing lies in choosing a set of scenarios that will produce a high degree of confidence in the functioning of the unit under test across the often very large range of possible inputs.
This article, Unit Testing, Scenarios and Categories: The SCAN Method, posted on my new GitHub blog, discusses how to do this, and proposes a method introduced in a recent GitHub project, called Scenario Category ANalysis, or SCAN for short.
It begins with a section on background that includes a link to a 2018 presentation on unit testing that introduced the concept of domain partitioning as a way of breaking infinite input spaces into a finite set of subspaces. This concept is explained here, followed by a discussion of how domain categories can form the basis for a practical approach to breaking up the input space. There is a section with examples of use of category sets to develop unit test scenarios taken from a range of my own Oracle GitHub projects.
Next, Scenario Category ANalysis (SCAN) is outlined as a systematic method for deriving unit test scenarios. We conclude with a section showing the application of the method to three examples using base code from third-party articles, taken from the GitHub project on the SCAN method.
There is an mp4 recording briefly (2m13s) going through the sections of the blog post:
Contents
The contents of the article are listed below. Click on the link above to access the article.
- Background
- Domain
- Domain Categories
- Generic Category Sets
- Unit Test Scenarios and Category Sets: Some Examples
- Scenario Category ANalysis (SCAN)
- SCAN Examples Of Use
- Conclusion
- See Also