Page 43 - SOFTWARE TESTING & QUALITY ASSURANCE
P. 43

Software Testing and Quality Assurance



                          can be easily depicted using state diagrams. These state diagrams consist of states and transitions. Every
                          program has two important states, the start state which indicates the beginning of the program and the
                          end state which indicates the end of the program. In between these two states, a number of intermediate
                          states represent the logical flow of the software. During the executions, the program flows from one
                          state to another. This change of state is called state transition.

                                             The Windows paint program expresses itself in different states. When the
                                             application is opened, the cursor takes the pencil tool as the default state. When
                                             a different tool is selected, say an air-brush, the cursor changes its state to bring
                                             out the properties of the air-brush. The internal working of the software toggles
                                             every time the user selects a different tool. This change can be termed as state
                                             transition.


                                      All software that is event driven makes use of state based techniques to analyze the
                                      program flow. For example, the GUI programs make use of state based techniques both
                                       at the design stage and at the testing stage.


                          The state diagram is a graph that depicts all the states and transitions taking place during the flow. The
                          tester checks the states and transitions occurring at each level of the state diagram. The tester has to
                          check each state and the transition that takes place, since every state is unique and each transition is a
                          new operation that is performed on the current state to generate an output that is moving to the next
                          state. This helps the tester to understand the flow of the software and detect the occurrence of the bugs
                          based on states and transition.
                                             Let us consider a program where a transition has to happen from state A to B
                                             and from B to C. The tester checks if the transition happens from state A to C
                                             and from C to  B. This  incorrect transition will be considered as  a bug in the
                                             software.
                          State based technique helps to obtain a model that depicts the behavior of a program  very clearly.
                          However, drawing a state diagram is a challenging task. Any software has many states and a transition
                          associated with it. Depicting the same can be a complex process.
                          3.2.5   Random Testing and Mutation Testing

                          Many other techniques of software testing are being used by testers around the world to obtain efficient
                          testing results. Two of the most popular and widely used testing techniques are random testing and
                          mutation testing.

                          Random Testing
                          In random testing, the tester provides random inputs to the test software and checks the output of the
                          software against the expected output. Any mismatch in the actual output and expected output will be
                          treated as a bug.
                                             In a mathematical expression,
                                             C = 2 * B;
                                             The variable B can take values from -500 to 500. The test can be carried out for
                                             five random values- 24, -348, 75, 499, and -1. The expected result would be 48, -
                                             696, 150, 998, and  -2 respectively. The expected result is  compared with the
                                             actual result when this expression is executed.
                          Random testing is one of the popular testing techniques which is also called as Gorilla testing or Adhoc
                          testing. This is discussed in detail in Chapter 9.

                          Mutation Testing
                          In this type of testing, the tester makes minor modifications in the program’s source code and performs
                          the test. If the program clears the test even after it  is modified, the program is considered to be
                          defective. Any such modification is called mutation. The main objective of mutation testing is to check



                          36                      LOVELY PROFESSIONAL UNIVERSITY
   38   39   40   41   42   43   44   45   46   47   48