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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ANALYZING THE TRIANGLE PROBLEM<br />

(Continued)<br />

In o<strong>the</strong>r words, <strong>the</strong> answer to <strong>the</strong> question (of how much testing is enough for j and k),<br />

depends on what assumptions we are willing to make.<br />

2. Verify that only and exactly three numbers can be entered successfully.<br />

(a) Verify that no more than three input lengths can be entered, or if <strong>the</strong>y can be, that<br />

<strong>the</strong> system queries as to which three of multiple input numbers represent <strong>the</strong><br />

actual three sides of <strong>the</strong> <strong>triangle</strong>.<br />

(b). Verify that a <strong>triangle</strong> computation cannot be performed if only two values are<br />

entered (representing only two sides of <strong>the</strong> <strong>triangle</strong>).<br />

The user interface may well be designed in a way that makes it physically impossible to<br />

test for only two numbers or for four numbers to be entered. In this circumstance, <strong>the</strong><br />

above tests are unnecessary. There is no point in testing for situations which we know<br />

cannot occur.<br />

However, in <strong>the</strong> functional spec. (i.e., in <strong>the</strong> exercise narrative), we are not told anything<br />

about <strong>the</strong> user interface. So <strong>the</strong> prudent approach is to include <strong>the</strong>se test cases, <strong>the</strong>n<br />

delete <strong>the</strong>m later if and when <strong>the</strong>y are found to be unnecessary.<br />

3. Verify that <strong>the</strong> <strong>triangle</strong> must close.<br />

Verify that invalid <strong>triangle</strong>s, where <strong>the</strong> sum of any two sides is not large enough to<br />

exceed <strong>the</strong> length of <strong>the</strong> third side, are detected and identified. In o<strong>the</strong>r words, check that<br />

<strong>the</strong> input is rejected with an appropriate error message if any of <strong>the</strong> three following<br />

conditions do not occur:<br />

(a) i + j = > k (and all three are numeric and positive)<br />

(i) i + j = k<br />

(ii) i + j > k<br />

(b) j + k = > i (and all three are numeric and positive)<br />

(The same two tests are needed as for i + j = > k, above)<br />

Copyright 2004 Collard 14 & Company<br />

Appendix 1<br />

14

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

Saved successfully!

Ooh no, something went wrong!