Question
software testing need help to answer the following questions below, focus is one question 3. the code and a picture a Control Flow Graph are
software testing
need help to answer the following questions below, focus is one question 3. the code and a picture a Control Flow Graph are included
questions
1 For the printPrimes() function, find a test case such that the corresponding test path visits the edge that connects the beginning of the WHILE statement to the IF statement that appears after the WHILE loop, without going through the body of the WHILE loop.(Write a fitting test case and test path)
2 Write a (set of) test path(s) that achieve Edge Coverage but not Prime Path Coverage on the graph. (Create test paths for Part 2)For each of them, identify the input(s) that will allow its execution. Suggestions: (A) Start by identifying the Test Requirements for both criteria (B) Multiple simple test paths will make your job easier when you have to identify the corresponding input, rather than one single complex path.
3 Convert the test cases described in Part 1 and Part 2 into JUnit test cases.
Control Flow Graph
code: public class PrintPrimes { //Empty Constructor public PrintPrimes(){} private boolean isDivisible (int i, int j) { if (j%i == 0) return true; else return false; } public int[] printPrimes (int n, boolean showAll) { int curPrime; // Value currently considered for primeness int numPrimes; // Number of primes found so far. boolean isPrime; // Is curPrime prime? int [] primes = new int [100]; // The list of prime number candidates. // Initialize 2 into the list of primes. primes [0] = 2; numPrimes = 1; curPrime = 2; while (numPrimes 22 numprimes an (3) curfrime tt; isprime = true; int i = 0 i
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