RAHUL goswami

RAHUL goswami

  • NA
  • 10
  • 8.7k

Triangle problem

Sep 24 2013 12:44 PM
I really want to understand this triangle problem in sense of testing. my questions are below.

1. Complete the reportTriangleType method in the Triangle class below. Given three integer
arguments as the three angles of a triangle, reportTriangleType returns the type of the
triangle, scalene, isosceles, or equilateral.

public class Triangle {
public static String reportTriangleType(int angleA, int angleB, int angleC) {
}
}

2. Design a test suite for the above program using equivalence partitioning and boundary value
analysis.
• Use a table to list all valid and invalid classes.
• Use a table to list all of your test cases to cover the valid and invalid classes. Each test
case should include both input and expected output.

3. Write a class TriangleTest to test reportTriangleType with all the test cases you have
designed. Fix the bugs, if any. You may use JUnit or NUnit. 
For example, the test case whose input is (60, 60, 60) and expected result is "equilateral"
can be translated into assertEqual(Triangle.reportTriangleType(60, 60, 60), "equilateral") or
if (!Triangle.reportTriangleType(60, 60, 60).equalsIgnoreCase("equilateral"))
System.out.println("test failed");

4. For each conditional statement in your program, determine whether or not the test cases
you designed for (2) have achieved branch coverage and multi-condition coverage 

Thanks for your help!

Answers (2)