Software Testing Challenge – Triangle Test
Have you ever had an interview question related to triangle testing? Something like, how would you test set of three input fields representing triangle sides. For each input, the output should be a message identifying the type of triangle based on your input. This test appears quite often in QA job interviews.
Initially this test was published in The Art Of Software Testing as a form of a self-assessment for the reader. The reader would know how good his QA skills were based on the results of this assessment. Of course, this is just one example in a myriad of testing questions available out there. Let’s discuss it by doing this testing challenge and we might be able to learn something new.
The testing challenge explanation
We have an application with three input fields, each representing one side of a triangle. When we enter something in the fields the calculator automatically calculates the triangle angles and draws a picture of it. If some input was invalid appropriate message should appear. You can enter sides or angles or a combination of sides and angles, but for the test we will focus on sides only.
Test actions blueprint
For a proper test we would need to test these inputs for various values, among which we should incorporate valid and invalid inputs. I would strongly recommend using boundary value analysis and equivalence partitioning to reduce the number of test cases and to find proper values for testing.
Feel free to engage into discussion about proper values you would use for testing and why.
Here is the list of high level test cases which should be taken into consideration:
- valid input for all three sides for equilateral triangle (e.g. 3, 3, 3)
- valid input for right triangle (e.g. 3, 4, 5)
- valid input for obtuse triangle (e.g. 2, 5, 6)
- valid input for isosceles triangle (e.g. 4, 4, 6)
- test case for each of the sides empty while the others have valid input
- test case for negative value in input fields
- test case for non-numeric characters in input fields (letters and special characters)
- test case for sum of two sides being less or equal to the third side (what values would you use and why?)
- test case for decimal values in input fields (what values would you use here?)
- test case for all sides being 0
- test case for extremely large numbers
- additional test case for SQL injection (try to type any SQL query in the input field)
- additional test case for Javascript injection (try to type javascript:alert(‘Triangle test’))
Obviously the list of test cases can grow really big and any test case you can think of apart from these is a plus.
Discussion
Have you documented the proper expected results for each case? Were there any inadequate behaviors? If yes, how would you write a bug report for it? What do you think about user experience of the calculator? Is it intuitive enough? Should it be redesigned for easier use? Which test cases would you automate? Do you feel comfortable enough to try test automation in a tool of your choice? For further practice you can expand this software testing challenge by including inputs for the angle fields. Feel free to share your questions and thoughts in the comment section.