2 Specification-based testing

 

This chapter covers

  • Creating test cases using specification-based testing
  • Identifying and creating test cases for program boundaries

Software requirements are undoubtedly the most valuable artifact of software testing. By requirements, I mean any textual document that describes what a functionality should do. Requirements tell us precisely what the software needs to do and what it should not do. They describe the intricacies of the business rules that the software has to implement and we need to validate. Therefore, requirements should be the first artifact you go for when it comes to testing!

In this chapter, we explore specification-based testing. These techniques use the program requirements—such as agile user stories or UML use cases—as testing input. We will discuss how to use all the information available in a requirement to systematically derive a set of tests that exercise that requirement extensively.

Where does specification-based testing fit into the entire testing process? Imagine that a software developer receives a new feature to implement. The developer writes the implementation code, guided by test-driven development (TDD) cycles, and always ensures that the code is testable. With all the classes ready, the developer switches to “testing mode.” It is time to systematically look for bugs. This is where specification testing fits in: it is the first testing technique I recommend using once you’re in testing mode.

2.1 The requirements say it all

 
 

2.1.1 Step 1: Understanding the requirements, inputs, and outputs

 
 

2.1.2 Step 2: Explore what the program does for various inputs

 
 
 

2.1.3 Step 3: Explore possible inputs and outputs, and identify partitions

 
 
 

2.1.4 Step 4: Analyze the boundaries

 
 
 

2.1.5 Step 5: Devise test cases

 
 

2.1.6 Step 6: Automate the test cases

 

2.1.7 Step 7: Augment the test suite with creativity and experience

 
 
 
 

2.2 Specification-based testing in a nutshell

 
 

2.3 Finding bugs with specification testing

 
 

2.4 Specification-based testing in the real world

 

2.4.1 The process should be iterative, not sequential

 
 

2.4.2 How far should specification testing go?

 
 
 
 

2.4.3 Partition or boundary? It does not matter!

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest