Professional Documents
Culture Documents
15001
25001
EP
• To design test cases using equivalence partitioning, for a range of
valid input values identify
• one valid value within the range
• one invalid value below the range and
• one invalid value above the range
EP
• Similarly, To design test cases for a specific set of values
• one valid case for each value belonging to the set
• one invalid value
• Test Cases for Types of Account (Savings, Current) will be
• Savings, Current (valid cases)
• Overdraft (invalid case)
• It may be noted that we need fewer test cases if some test cases can
cover more than one equivalent class.
2. Boundary Value Analysis
• Equivalence partitioning states that testing one value from a class
is equivalent to testing any other value from that class,
• Look at the boundaries of equivalent classes more closely.
• Boundaries are more error prone.
• To design test cases using boundary value analysis, for a range of
values,
• Two valid cases at both the ends
• Two invalid cases just beyond the range limits
The test cases using boundary value analysis
are
1
3. Cause Effect Analysis
• drawback of the EP and BVAthey do not explore the combination
of input conditions.
• Cause effect analysis is an approach for studying the specifications
carefully and identifying the combinations of input conditions
(causes) and their effect in the form of a table and designing test
cases
• It is suitable for applications in which combinations of input
conditions are few and readily visible
4. Cause Effect Graphing
• This is a rigorous approach, recommended for complex systems only.
• In such systems the number of inputs and number of equivalent
classes for each input could be many and hence the number of input
combinations usually is astronomical.
• Hence we need a systematic approach to select a subset of these
input conditions.
Guidelines for Graphing
• Divide specifications into workable pieces as it may be practically difficult to work on large
specifications.
• Identify the causes and their effects.
• A cause is an input condition or an equivalence class of input conditions.
• An effect is an output condition or a system transformation.
• Link causes and effects in a Boolean graph which is the cause-effect graph.
• Make decision tables based on the graph. This is done by having one row each for a node in the
graph.
• The number of columns will depend on the number of different combinations of input conditions
which can be made
• Convert the columns in the decision table into test cases.
Example
Example to check whether the given input
forms a triangle
• Firstly: Recognize and describe the input conditions (causes) and
actions (effect).
Source: geeksforgeeks.org
Basis Path Testing
binarySearch() Example
CFG of Binary search
Cyclomatic Complexity
Properties of Cyclomatic complexity:
• Following are the properties of Cyclomatic complexity:
• V (G) is the maximum number of independent paths in the graph
• V (G) >=1
• G will have one path if V (G) = 1
• Minimize complexity to 10
CC-Independent path
Cyclomatic Complexity-Ways
Different methods to calculate V(G)
Steps to be followed in cC
• The following steps should be followed for computing Cyclomatic
complexity and test cases design.
• Step 1 - Construction of graph with nodes and edges from the code
• Step 2 - Identification of independent paths
• Step 3 - Cyclomatic Complexity Calculation
• Step 4 - Design of Test Cases
• Once the basic set is formed, TEST CASES should be written to
execute all the paths.
Cyclomatic Complexity of Function
binarySearch()
CC Number
Complexity Number Meaning
Structured and well written code
1-10 High Testability
Cost and Effort is less
Complex Code
10-20 Medium Testability
Cost and effort is Medium
Very complex Code
20-40 Low Testability
Cost and Effort are high
Not at all testable
>40
Very high Cost and Effort
Deriving Basis Test Cases
Deriving Basis Test Cases Contd..
Deriving Basis Test Cases
Other Example
Find the complexity?