Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Suppose that we have a class with some method that takes four input values, each representing one side of a proper tetragon. The function returns

Suppose that we have a class with some method that takes four input values, each representing one side of a proper tetragon. The function returns the information (a String) telling whether the given values represent the side lengths of a Square, a Rectangle, or a Trapezoid. public class identifyShapes public String identifyTetragon(int a, int b, int c, int d) throws NotAValidTetragon, InvalidSideException The method throws a NotAValidTetragon exception if the supplied values do not fit into any of the possible three tetragons it is expected to find out, and the function throws a InvalidSideException if any of the supplied values do not represent a valid value for a geometric shape. Types of proper tetragons the function can discriminate are:
a. Identify the equivalence classes for both the input and output domains of the above function, and come up with a proper diagram (similar to the partitioning diagram available on slide #26 of lecture notes for week09) that depict those equivalence classes.
slide #26 of lecture notes for week09:
b. Develop a set of test cases, i.e., test suite for the method for which a Java signature is given above. You are NOT expected to write the Java source code for the implementation of the above given method, but only to list the test inputs, and expected outputs, i.e., fill in the below table. You can add rows to the below table as required. Make sure that each equivalence class you identified above is covered with at least one test case, and also boundary value analysis is applied for all boundaries present in your partitions. Hint: Do not neglect the invalid behavior tests!
TestCaseNumber Unit Under Test a b c d Expected output
TC#1
TC#2
...
TC#n
4. a. What type of testing can you perform via the above written test cases for question 3? b. Assume that all test cases you devised above passed against some implementation of the identifyTetragon method mentioned above. Furthermore, assume that you have another function which takes a String indicating the type of some geometric shape, and outputs a small (Unicode) symbol of that geometric shape on the terminal console. public void printShapeInfo (String shape){
if shape.equals(circle) System.out.println ("u\25ef"); //Unicode for a small circle:
else if shape.equals(triangle) System.out.println ("\u25b3"); //Unicode for a small triangle:\geotriangle
else if shape.equals(square) System.out.println ("\u25a1"); //Unicode for a small square:\geoquad
else if shape.equals(trapezoid) System.out.println ("\u25ca");//Unicode for a small trapezoid:
...
...
...
else System.out.println (I dont know this shape!!!); }
Assume also that all test cases devised to test the printShapeInfo passed, i.e., printShapeInfo prints the correct symbol for the given shape information. The aim is to test a Java program developed by using the above given methods, which, when the user enters four integers representing a tetragon, prints the small symbol of that tetragon on the console. Come up with an integration test scenario in which both identifyTetragon and printShapeInfo methods are tested collectively in an integrated fashion (i.e., the return value of one method is used as an input to the second), but the test scenario fails. What might have caused the integration test to fail even though both of the individual methods are known to be bug free? Please explain your answer with specific examples.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started