Beruflich Dokumente
Kultur Dokumente
sequence
if
while
…
case
until
• A flow graph uses different symbols .Circles represent nodes
which are used to depict the procedural statements present in
the program .A series of process boxes and a decision
diamond in a flow chart can be easily mapped into a single
node. Arrows represent edges. Which are used to depict the
flow of control within a program. In a flow graph the area
bounded by edges and nodes is known as region.
• While counting regions the area outside the flow graph is also
counted as a region
1
R4
R3
1 9 2
9 3 7
2 R1
3 4 R2 5
7
4 5
6
6 8
8
• Independent paths
• P1:1-9
• P2:1-2-7-8-1-9
• P3:1-2-3-4-6-8-1-9
• P4:1-2-3-5-6-8-1-9
• Cyclomatic complexity
• 1.total number of regions
• 2. cc= E- N+2
• 3.CC = P+1( number of predicate nodes +1)
• Predicate node is a node that contains condition.
• In the above example the cyclomatic complexity is calculated
as CC= 11- 9+2 = 4
• Number of regions =4
• C=using the formula cc = p+1 cyclomatic complexity is
calculated as cc= 3+1 =4
• Example:
• Draw the flow graph of the program
• Procedure greater
• Integer :a, b, c=0;
• Enter the value of a;
• Enter the value of b;
• If a>b then
• C=a;
• Else
• C=b;
end greater
• Flow graph
Cc= 2 regions
1
Or
Cc= 6 edges -6nodes +2 = 2
R2 Or
2
Cc = 1 predicate node +1 = 2
R1
4 5
6
Control structure testing
Unstructured loop
• Mutation testing
• Mutation testing is white box method where errors are
purposely inserted into a program to verify whether the
existing test case is able to detect the error or not .In this
testing , mutants of the program are created by making some
changes in the original program.
• Steps in mutation testing
• 1.create mutants of a program
• 2.Check both program and its mutants using test cases
• find the mutants that are different from the main program
• ,that is mutants that produce outputs that are different from
the outputs produced by the program.
(VTB, 2008)
Orthogonal array testing
Orthogonal array testing can be defined as a mathematical
technique that determines the variations of parameters that
need to be tested. This testing is performed when limited data
is to be given as input. it is helpful in finding errors in the
software where incorrect logic is applied.
• Runs: the number of rows in the array. This directly translates
to the number of test cases that will be generated by the
OATS technique.
• Factors: the number of columns in an array. This directly
translates to the maximum number of variables that can be
handled by this array.
• Levels: the maximum number of values that can be taken on
by any single factor. An orthogonal array will contain values
from 0 to Levels-1.
Orthogonal array testing-common terms
• Runs; number of rows which translates to test
cases
– Since the rows represent an experiment (test) to
be run, it is a goal to minimize the number of row
as much as possible
• Factors; number of columns which is the
number of variables
• Levels; max number of values for a factor
( 0 – levels-1 )
Technique
• First, determine how many independent
variables you need to test for interaction
(factors)
• Second, determine how many values (levels)
each of these variables will have
• Next, find an orthogonal array that maps to
this requirement
– At least as many factors from step 1
– At least as many levels from step 2
Technique
• Next, map the factors and levels on to the
array
• Choose values for the “left over” levels
• Create test cases for each run
The OAT Theory
Run1 0 0 0
Run2 0 1 1
Run3 1 0 1
Run4 1 1 0
Orthogonal array after mapping factors