Software Testing

Steven J. Zeil

March 9, 2012


Table of Contents

1. Testing I: Supplying Inputs to Programs
2. Debugging I: The Basics
3. Testing II: Black-Box Testing
1. Black-Box Testing
1.1. Testing
1.2. Black Box Testing
1.3. Choosing the Test Data
4. Debugging II: Systematic Debugging
5. Testing IV: White-Box Testing
1. White-Box Testing
1.1. White-Box Testing
1.2. Statement Coverage
1.3. Branch Coverage
1.4. Loop Coverage
1.5. Final Thought: Combining Black and White-Box Testing
6. Testing V: Unit Testing
1. Unit Testing
1.1. Types of Testing
1.2. Unit Testing
1.3. Integration Testing
7. Debugging III: Tracking Down the Culprit

This is an early draft of a textbook supplement devoted to the topic of software testing.

Look at any catalog of Computer Sicence textbooks and you will find numerous books with titles like "Programming in C++", "Introduction to Programming in Java", etc. Most of these books do not, however, teach programming. They teach coding, the information necessary to write programs in some specific programming language.

For both professional and student programmers, however, coding is only a part of the larger process of programming. In particular, programmers will typically spend as much or more time in testing and debugging as they do in coding. Yet most of these programming texts give these topics passing mention at best. I challenge you - grab the closest "Programming in..." book that you can lay your hands on. Look in the index for testing and debugging. What percentage of the book addresses these topics? 1%? 0.1%? That's not much attention for an activity that can take 50% of a programmer's time.

For instructors who prefer to stick close to their textbooks in preparing their courses, this means that students will be left to fend for themselves on these topics. The inevitable result is students who are unpleasantly surprised to discover that their submitted programming assignments fail the instructors' tests, or who can't figure out how to fix problems in their code without someone else walking them through a diagnostic procedure.

I am a firm believer that testing and debugging are teachable subjects, and that such instruction should an essential and integrated part of early programming classes.

The chapters that follow are gleaned from my notes for courses taught at Old Dominion University. My intention is to develop supplemental chapters they can be inserted into the course outline of most C++ and Java introductory courses.