O'Reilly logo

Pragmatic Software Testing: Becoming an Effective and Efficient Test Professional by Black, Rex, Rex Black Consulting Services, Bulverde, Texas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Triangle Test Exercise

In this exercise, you get your first chance in this book to build a test case. Even if you think of yourself as an experienced tester, you might want to give it a try. It’s amazing how few people — even people who have been testing for years — get this exercise right.

Exercise: The Triangle Test

Suppose you’re told to test a very simple program. This program accepts three integers as inputs or arguments. These integers represent the lengths of a triangle’s sides. The program prints “Equilateral” (three equal sides), “Isosceles” (two equal sides), or “Scalene” (no equal sides), as shown in Figure 2-1.[1]

Three types of triangles

Figure 2-1. Three types of triangles

Your assignment is to write an effective and efficient set of test cases. By effective, I mean that the set of tests finds common bugs. By efficient, I mean that the set of tests finds those bugs with a reasonable amount of effort. By test case, I mean tester action, data, and expected result. Here the action is usually to input some data, but it might be other actions as well.

A template is provided for your solution. I suggest you format your solution to look the same as the template. I suggest 30 minutes as a time limit. When you’re done, continue through the rest of this chapter to see my answers.

Your Solution for the Triangle Test

Tester Action And Data

Expected Result

_________________________________________________________ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required