Do you want to take on the role of a tester? If yes, you will be tasked with checking a particular method.
This method receives three integers as parameters that are interpreted as the side lengths of the triangle. The output of the method is a message about whether the triangle is scalene, equilateral or isosceles.
Write a set of tests on a blank sheet of paper (i.e., specific data series), which, in your opinion, will adequately test this method. Once your tests are ready, investigate them necessarily.
The next step is to verify the effectiveness of your test. It proves that the method is much harder to write than it might seem at first glance. Different versions of this method have been studied and a list of the common errors has been compiled. Analyze your test suite by using it for the purpose of answering the questions given below. Each answer “yes” is awarded one point.
Software testing as a service is a new popular outsourcing model for validation work that enables companies to fully focus on their main development processes while quality assurance activities will be handled by independent experts.
- Have you drawn up a test that represents a non-right-angle scalene triangle? (Note that the answer “yes” to the tests with the values like 1, 2, 3 and 2, 5, 10 is not justified, since there are no triangles having such side lengths.)
- Have you drawn up a test that represents a right angled equilateral triangle?
- Have you drawn up a test that represents the isosceles right triangle? (Tests having values of 2, 2, 4 should not be considered.)
- Have you drawn up at least three tests that represent the isosceles right-angled triangles obtained by permuting two equal sides of the triangle (for instance, 3, 3, 4, 3, 4, 3 and 4, 3, 3)?
- Have you drawn up a test where one side of the triangle has the length 0?
- Have you drawn up a test where one side of the triangle is a negative value?
- Have you drawn up a test that includes three positive integers, and the sum of these two numbers is equal the third? (In other words, if the program reports that the numbers 1, 2, 3 represent the sides of a scalene triangle, then this program has an error.)
Without doubt, there is no guarantee that a set of tests that meets the above conditions, will find all possible errors. But whereas questions 1-7 represent errors that have been encountered in different versions of this method, an adequate test run on it should detect them. For purposes of comparison, we may note that experienced professional programmers and testers gain only 7-8 points on average, out of 14 possible. The exercise performed shows us that testing of even simple programs is not a trivial task.