Implementation < 2 >  
Coding of GUI and Completion of Modules

  Testing:  

It is the process of exercising or evaluating a system by manual or automatic means to verify that is satisfies specified requirements or to identify differences between expected and actual results.

 

  Test cases and test dates:  

They are not the same thing.

Test data - are the inputs which have been devised to test the software.
Test cases – are consists of inputs, expected outputs and the name of the subprogram to be tested.


 

 White Box Test Technique:

White box testing is also called structural testing because it uses the internal structure of the program to derive the test cases. It is a procedural logic and therefore can also be applied at the detailed design stage to a procedural design. The three white box test techniques are

  • Basic path testing
  • Graph matrices
  • Loop testing
 
 
  A) Basic Path Testing (Flowgraph notation)  

The Flowgraph depicts logic or control flow using the following notation.

  • Node-represented by a circle and it represents one or more non-branching procedural statements or a block scope definitions.
  • Edges-represented by arrows and represent flow of control or logic. An edge must terminate at a node

 To ensure maximum path coverage, we need enough test cases to ensure that:

  • Every statement in a component has been executed at least once,
  • Every decision (branch or case statement) has been executed on its true and false side.

Any procedural design representation, PDL, flow charts, box diagrams, except decision tables, can be translated into a Flowgraph.

Areas bounded by edges and nodes are called regions. When counting regions, we include the area outside the graph and count it as a region. a predicate node is a node having two exit points. The case construct may be expressed as n-1 predicate nodes where n is the number of action branches in the case construct.

Next, after obtaining the Flowgraph, we need to compute the Cyclomatic Complexity of the Flowgraph

Cyclomatic Complexity

It is denoted by V(G), which is a software metric that provides a quantitative measure of the logical or control complexity of an algorithm or program.

It can be determined by the following three ways:

  • Count the regions of the Flowgraph
  • Compute V(G) = Edges- Nodes+2
  • Add one to number of predicate nodes

Industry studies have indicated that the higher the V(G), the higher the probability of error.

 

 

  B) The basis Set  

When used in the context of basis path testing, the value computed for the Cyclomatic Complexity defines the number of linearly independent paths in the basis set of algorithm or program. It provides us with an upper bound for the number of tests (test cases) that must be conducted to ensure maximum path coverage.

 Linearly independent paths

  • Any path through a Flowgraph that will go through a new edge and node.
  • Cannot be duplicated by any other combination of paths.
  • Equal to V(G).

 The Basis Set is then the set of all linearly independent paths through a given Flowgraph.

 Then we derive the test cases, example of one is given below:

Path1 (1,2,3,4,8,9)

Test case 2:      inputs:

                        Expected result:

                        Subprogram:

 

 

  C) Graph Matrices  

The procedure of deriving the Flowgraph and determining the basis set of linear independent paths can be mechanized through software. It will make use of a data structure called a graph matrix.

 A graph matrix is an N x N where N is equivalent to the number of nodes in a Flowgraph. Each row and column of the matrix corresponds to an identified node and matrix entries correspond to connections (an edge) between nodes.

 Numbers represents each node and each edge is identified by alphabets.

 By adding a link weight to each matrix entry, the graph matrix can become a powerful tool for evaluating program control structure during testing.

Link Weights

It provides additional information about control flow. In its simplest form, the link weight is 1(connection exists) or 0(a connection does not exists). A connection matrix is thus formed.

There are some other properties:

  • The probability that a link (edge) will be executed
  • The processing time consumed during transversal of the link
  • The memory required during transversal of a link

 

 

  D) Loop Testing  

It is a white-box testing technique that focuses on the validity of loop constructs. There are 4 different types of loops:

  • Simple loops
  • Nested loops
  • Concatenated loops
  • Unstructured loops

 

Simple loops

The following set of tests should be applied to simple loops where n is the maximum number of allowable passes through the loop:

  • Skip the loop entirely
  • Only one pass through the loop
  • Two passes through the loop
  • m passes through the loop where m<n
  • n-1, n , n+1 passes through the loop

 

Nested Loops

The following test approach is for nested loops:

  • Start at the most innermost loop. Set all the other loops to minimum values
  • Conduct simple loop tests for the innermost loop while holding the outer loops at their minimum iteration parameter (e.g. loop counter values).
  • Work outwards, conducting tests for the next loop but keeping all other loops at minimum values and other nested loops to “typical values”.
  • Continue until all the loops have been tested.

 

Concatenated Loops

They can be tested using the approach defined for simple loops if each of the loops is independent of each other. Though when they are not independent, then the approached applied to nested loops is recommended.

Unstructured loops

No possible test, should be redesign to reflect the use of structured constructs

 

 

Hosted by www.Geocities.ws

1