retagged by
3,568 views
2 votes
2 votes

Find if the following statements in the context of software testing are TRUE or FALSE.
(S1): Statement coverage cannot guarantee execution of loops in a program under test.

(S2): Use of independent path testing criterion guarantees execution of each loop in a program under test more than once.

  1. True, True
  2. True, False
  3. False, True
  4. False, False
retagged by

3 Answers

2 votes
2 votes

The statement coverage strategy aims to design test cases so that every
statement in a program is executed at least once
. The principal idea governing
the statement coverage strategy is that unless a statement is executed, it is very
hard to determine if an error exists in that statement. Unless a statement is
executed, it is very difficult to observe whether it causes failure due to some
illegal memory access, wrong result computation, etc. However, executing some
statement once and observing that it behaves properly for that input value is no
guarantee that it will behave correctly for all input values. 

Example: Consider the Euclid’s GCD computation algorithm:
 int compute_gcd(x, y) 
 {

  int x, y;
  while (x! = y){
   if (x>y) then
      x= x – y;
   else

     y= y – x;
  }
  return x;
 }

By choosing the test set {(x=3, y=3), (x=4, y=3), (x=3, y=4)}, we can exercise the 
program such that all statements are executed at least once. 

Thus we can conclude that (S1) is FALSE.


The path-coverage testing does not require coverage of all paths but only coverage of linearly independent paths.The path coverage-based testing strategy requires us to design test cases such that all linearly independent paths in the program are executed at least once.

Linearly independent path ( WRT Control Flow Graph )

A linearly independent path is any path through the program that introduces at least one new edge that is not included in any other linearly independent paths. If a path has one new node compared to all other linearly independent paths, then the path is also linearly independent.

Thus (S2) is TRUE.

C) is the answer.

1 votes
1 votes
Correct option is A.
0 votes
0 votes
The correct answer is False, False.

(S1) is false because statement coverage is a testing criterion that aims to ensure that every statement in the program under test is executed at least once. This includes statements inside loops, so statement coverage can guarantee the execution of loops in a program.

(S2) is also false. Independent path testing is a testing criterion that aims to ensure that every independent path through the program is executed at least once. An independent path is a sequence of statements that can be executed without the execution of any other statements in the program. However, independent path testing does not guarantee the execution of each loop in a program more than once. It only guarantees that every independent path is executed at least once, regardless of whether it includes a loop or not.
Answer:

Related questions