Page 59 - SOFTWARE TESTING & QUALITY ASSURANCE
P. 59

Software Testing and Quality Assurance



                          The different types of code coverage testing is shown in figure 4.3

                                                        Figure 4.3: Code Coverage Types


















                          Now, let us discuss the types of code coverage.

                           1.   Statement Coverage: The simplest form of code coverage is known as statement coverage or line
                               coverage. A software tester needs to ensure that all the statements are executed at least once.

                                             1: PRINT “Good Morning”

                                             2: PRINT “Be Positive”
                                             3: PRINT “Today is a Great Day”
                                             4: END




                          Did you know?   Data coverage method is considered to be more effective than the statement coverage
                                        testing, as it uncovers more faults with fewer tests.

                              In the above mentioned program, all the statements are  executed once. Sometimes statement
                              coverage can be misleading.  This is due to the fact that statement coverage  can  provide
                              information relating to the  execution of  each  statement  only,  and not  relating to the paths
                              traversed in the software.
                           2.   Path Coverage: Path coverage relates to covering all the paths in the software. The simplest form
                               of path testing is known as branch coverage testing.
                               Loops are the  important parts of a  structured program.  The direction in which the control
                               proceeds in a program  and the  number of times the statement gets executed is based  on the
                               initiation and termination condition of loops. Testing such types of loops is a challenging task, as
                               an error may be revealed only after exercising some of the sequence of decisions or particular
                               paths in a program.

                                             An ‘If statement’ that creates a condition

                                             1: PRINT “Good Morning”
                                             2: IF Date$ = “25-12-2008” then
                                             3: PRINT “MERRY CHRISTMAS”
                                             4: END IF
                                             5: PRINT “The date id:”; Date$




                          52                      LOVELY PROFESSIONAL UNIVERSITY
   54   55   56   57   58   59   60   61   62   63   64