22.04.2013 Views

appendix 1. analyzing the triangle problem - Testing Education

appendix 1. analyzing the triangle problem - Testing Education

appendix 1. analyzing the triangle problem - Testing Education

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ANALYZING THE TRIANGLE PROBLEM<br />

“No book on software testing is complete without a discussion of <strong>the</strong> <strong>triangle</strong> <strong>problem</strong>.” Ed Kit.<br />

(This is meant as a joke, because this <strong>problem</strong> has been thoroughly worked and re-worked over<br />

<strong>the</strong> years. Never<strong>the</strong>less, this <strong>problem</strong> still retains its educational value.)<br />

At least six self-proclaimed experts have developed answers for <strong>the</strong> <strong>triangle</strong> <strong>problem</strong> (including<br />

this self-proclaimed expert, <strong>the</strong> author), and each answer is different. When experts do not agree<br />

on <strong>the</strong> answer to a seemingly simple <strong>problem</strong>, perhaps this tells us something about <strong>the</strong> state of<br />

<strong>the</strong> art of testing.<br />

The <strong>triangle</strong> <strong>problem</strong> was mentioned in Chapter III. Using intuitive, off-<strong>the</strong>-cuff techniques,<br />

systems professionals were able to identify only about half <strong>the</strong> test cases for <strong>the</strong> <strong>triangle</strong> <strong>problem</strong>.<br />

This <strong>problem</strong> provides an opportunity to see how <strong>the</strong> functional analysis, path analysis, boundary<br />

value and risk assessment methods can be applied.<br />

Re-Statement of <strong>the</strong> Problem<br />

Develop a set of test cases to adequately test a program, which works as follows:<br />

The program reads three input numbers that represent <strong>the</strong> lengths of <strong>the</strong> three sides of a<br />

<strong>triangle</strong>.<br />

Based on <strong>the</strong>se three input values, <strong>the</strong> program determines whe<strong>the</strong>r <strong>the</strong> <strong>triangle</strong> is scalene<br />

(that is, it has three unequal sides), isosceles (two equal sides), or equilateral (three equal<br />

sides).<br />

The program displays <strong>the</strong> result on <strong>the</strong> screen.<br />

Glen Meyers originally described this <strong>problem</strong> in his book, “The Art of Software <strong>Testing</strong>”.<br />

Exercise (Allow 15 to 20 minutes for this exercise.)<br />

There is no one correct <strong>the</strong>oretical answer to any testing <strong>problem</strong>. The answer depends on <strong>the</strong><br />

assumptions and judgement calls which <strong>the</strong> test planner makes.<br />

Review and critique <strong>the</strong> following set of test cases for <strong>the</strong> <strong>triangle</strong> <strong>problem</strong>. How do you suggest<br />

that we improve <strong>the</strong>m?<br />

Copyright 2004 Collard 2 & Company<br />

Appendix 1<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!