This assignment is mainly based on the code, drawing the control flow diagram, and related to the side coverage, point coverage, the master path of knowledge.
The specific job content is as follows
/******************************************************* * Finds and prints n prime integers * Jeff Offutt, Spring 2003 ******************************************************/public static void Printprimes (int n) {in T Curprime; Value currently considered for primeness int numprimes; Number of primes found so far. Boolean isprime; Is Curprime prime? int [] primes = new int [maxprimes]; The list of prime numbers. Initialize 2 into the list of primes. primes [0] = 2; Numprimes = 1; Curprime = 2; while (Numprimes < n) {curprime++;//Next number to consider ... isprime = true; for (int i = 0; I <= numPrimes-1, i++) {//For each previous prime. if (curprime%primes[i]==0) {//Found a divisor, curprime is not prime. IsPrime = false; Break Out of Loop ThrougH primes. }} if (IsPrime) {//Save it! Primes[numprimes] = Curprime; numprimes++; }}//End while//Print all the primes out. for (int i = 0; I <= numPrimes-1; i++) {System.out.println ("Prime:" + primes[i]); }}//End Printprimes
Draw a Control flow chart
Second, design a t2= (n=5) than t1= (n=3) easy to find errors found
Write a test case so that the corresponding test path access connection While statement starts to the edge of the FOT statement, instead of passing through while the loop body
T:n=1
Iv. example of each node overlay, Edge overlay and master path covered TR
Node Overwrite requirement: {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
Side coverage Requirements: {(a), (2,11), (2,3), (3,4), (4,5), (5,6), (5,7), (6,5), (6,9), (7,8), (7,2), (8,2), (9,10), (10,7), (11,12), (12,13), (12,15), (13,14), (14,12)}
Main PATH Coverage requirements:
Software Test Third Job