Question
For the attached triangle function, create test suites using the following methods ( Make sure to look in the book, the test cases at the
For the attached triangle function, create test suites using the following methods (Make sure to look in the book, the test cases at the bottom, to see which have already been identified for you):
- Normal Boundary Value Analysis Testing
- Weak Normal Equivalence Class Testing
- Decision Table-Based Testing
Report the code coverage (from both ElcEmma via JUnit and from PITTest) and mutation score for each test suite. Please be sure to include the number of mutants killed and total mutants.
Based on the results, answer the following questions:
- How does each method do at killing mutants? Why?
- Would other variants of these same methods (e.g., Strong Robust Equivalence Class Testing) perform better at killing mutants? Justify your answer via identification of test cases that do or do not improve mutation score.
Identify at least one mutation not identified by the previous methods and:
- Create a test to kill the mutation, and
- Discuss if the test adds value to the test suite.
CODE BELOW
-----
public class Triangle { public static final int INVALID = -1; public static final int SCALENE = 0; public static final int ISOSELES = 1; public static final int EQUILATERAL = 2; public static int triangle2(int a, int b, int c) { boolean isATriangle; // Is A Triangle? if((a----
import static org.junit.Assert.*; import org.junit.Test; public class TriangleTest { @Test public void test() { assertEquals(Triangle.INVALID, Triangle.triangle2(0, 0, 0)); assertEquals(Triangle.INVALID, Triangle.triangle2(1, 1, 3)); assertEquals(Triangle.EQUILATERAL, Triangle.triangle2(2, 2, 2)); assertEquals(Triangle.ISOSELES, Triangle.triangle2(2, 2, 3)); assertEquals(Triangle.SCALENE, Triangle.triangle2(2, 3, 4)); } }----------
TEST CASES BELOW
Table 5.1 Normal Boundary Value Test Cases Expected Output Isosceles Isosceles Equilateral Case 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 199 Isosceles Not a triangle Isosceles Isosceles Equilateral Isosceles Not a triangle Isosceles Isosceles Equilateral 200 100 199 200 100 100 100 100 100 100 100 100 100 100 100 100 10 12 100 100 199 200 13 100 Isosceles 100 Not a triangle 15 Table 7.2 Decision Table for Triangle Problem c1: a, b, c form a triangle? e2: a = b? c3: a c? F TT T T T TT T a1: Not a triangle a2: Scalene a3: Isosceles a4: Equilateral a5: Impossible XIX Table 5.1 Normal Boundary Value Test Cases Expected Output Isosceles Isosceles Equilateral Case 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 199 Isosceles Not a triangle Isosceles Isosceles Equilateral Isosceles Not a triangle Isosceles Isosceles Equilateral 200 100 199 200 100 100 100 100 100 100 100 100 100 100 100 100 10 12 100 100 199 200 13 100 Isosceles 100 Not a triangle 15 Table 7.2 Decision Table for Triangle Problem c1: a, b, c form a triangle? e2: a = b? c3: a c? F TT T T T TT T a1: Not a triangle a2: Scalene a3: Isosceles a4: Equilateral a5: Impossible XIX
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started