Click to add Title
e-Infochips Institute of Training Research and Academics Limited
Dynamic testing techniques
Prepared by : Jimi Patel
Arpan Shah
Kalindi Vora
INDEX
• What is Dynamic testing?
•Types of Dynamic testing
•Classification
•What is Black box testing and its techniques
•What is White box testing and its techniques
•Difference between Black box and White box testing
•Advantages and disadvantages of Dynamic testing
What is Dynamic testing?
•Dynamic Testing is a kind of software testing technique
using which the dynamic behaviour of the code is analysed.
•It checks for functional behaviour of software system ,
memory/CPU usage and overall performance of the system.
Hence the name “Dynamic”.
•When the code being executed is input with a value, the
result or the output of the code is checked and compared
with the expected output. This testing is also called as
Execution technique or validation testing.
Types of Dynamic testing
•Black box testing
•White box testing
Classification
What is Black box testing?
•Black Box Testing is a method of testing in which the internal
structure/ code/design is NOT known to the tester.
•The main aim of this testing to verify the functionality of the
system under test and this type of testing requires to execute
the complete test suite and is mainly performed by the Testers,
and there is no need of any programming knowledge.
Black box testing techniques
Black Box testing techniques are:
•Boundary Value Analysis
•Equivalence partitioning
•Error Guessing
•Cause Effect Graphing
•State Transition Testing
Boundary value analysis
•Boundary Value Analysis is the most commonly used test case
design method for black box testing. This is one of the
techniques used to find the error in the boundaries of input
values rather than the center of the input value range.
•Boundary Value Analysis is the next step of the Equivalence
class in which all test cases are design at the boundary of the
Equivalence class.
•Suppose we have software application which accepts the input
value text box ranging from 1 to 1000, in this case we have
invalid and valid inputs:
Invalid Input Valid Input Invalid Input
0 – less 1 – 1000 1001 – above
Boundary value analysis
•Here are the Test cases for input box accepting numbers using
Boundary value analysis:
•This is testing techniques is not applicable only if input value
range is not fixed i.e. the boundary of input is not fixed.
Min value – 1 0
Min Value 1
Min value + 1 2
Normal Value 1 – 1000
Max value – 1 999
Max value 1000
Max value +1 1001
Equivalence partitioning
•The equivalence class partition is the black box test case
design technique used for writing test cases.
•This approach is use to reduce huge set of possible inputs to
small but equally effective inputs.
•This is done by dividing inputs into the classes and gets one
value from each class.
•Such method is used when exhaustive testing is most wanted
& to avoid the redundancy of inputs.
Equivalence partitioning
•A program which edits credit limits within a given range
($10,000 -$15,000) would have three equivalence classes:
1.Less than $10,000 (invalid)
2.Between $10,000 and $15,000 (valid)
3.Greater than $15,000 (invalid)
•Valid values: $10,000 <= Value <= $15,000
•Invalid values: < $10,000 and > $15,000
Error guessing
•The purpose of error guessing is to focus the testing activity
on areas that have not been handled by formal techniques,
such as equivalence partitioning and boundary value analysis.
•Error guessing is the process of making an educated guess as
to how the other types of areas should be tested.
•This can be done based upon past test results, past testing
experience, by making a list of possible errors or error-prone
situations. And then, develop test cases based on the
list/experiences.
•Defect history can be useful.
Cause Effect graphing
•Cause Effect Graph is a black box testing technique that
graphically illustrates the relationship between a given
outcome and all the factors that influence the outcome.
Cause Effect graphing
Example,
A bank gives interest at the end of 1 year to those who have not withdrawn money
even once.
Accounts with amount greater than $10,000 get interest of 3%.
Accounts with amount greater than $25,000 get interest of 5%.
Accounts with amount greater than $50,000 get interest of 9%. If above accounts have
withdrawn money get interest of 1%.
Accounts with amount less than $10,000 get interest of 0%.
Cause Effect graphing
•Decision table:
State Transition
•This testing technique validates the states when program
moves from one state to another.
•Each functionality should be validated in each stage .
•Appropriate for systems that are described as finite state
machine. (Example: ATM)
•A state transition model has four basic parts:
•The states that the software may occupy (ATM
funded/insufficient funds);
•The transitions from one state to another;
•The events that cause a transition (withdrawing money);
•The actions that result from a transition (an error message, or
being given your cash).
What is White box testing?
•White Box Testing is a software testing method in which the
internal structure/ design is known to the tester. The main aim
of White Box testing is to check on how System is performing
based on the code. It is mainly performed by the Developers or
White Box Testers who has knowledge on the programming.
White Box testing techniques
•Code Coverage
•Code complexity
Code Coverage
•Statement Coverage - design test cases so that every
statement in a program is executed at least once.
•Branch Coverage - This technique is running a series of tests
to ensure that all branches are tested at least once.
•Path Coverage - This technique corresponds to testing all
possible paths which means that each statement and branch is
covered.
Statement Coverage
•Statement coverage is used to derive scenario based upon the
structure of the code under test.
Statement coverage
Printsum (Int a, Int b) { ------------ Printsum is a function
Int result = a+ b;
If (result> 0)
Print ("Positive", result)
Else
Print ("Negative", result)
} ----------- End of the source code
Scenario 1 Source Code:
Solution for Scenario 1:
If A = 3, B = 9
Number of executed statements = 5, Total number of statements = 7
Statement Coverage: 5/7 = 71%
Solution for Scenario 2:
If A = -3, B = -9
Number of executed statements = 6, Total number of statements = 7
Statement Coverage: 6/7 = 85%
Statement coverage
But overall if you see, all the statements are being covered by
2
nd
scenario's considered.
So we can conclude that overall statement coverage is 100%.
Branch/Decision coverage
Read A
Read B
IF A+B > 10
THEN Print "A+B is Large"
ENDIF
If A > 5
THEN Print "A Large"
ENDIF
Example:
Branch/Decision coverage
Branch/Decision coverage
•To calculate Branch Coverage, one has to find out the minimum
number of paths which will ensure that all the edges are covered.
•In this case there is no single path which will ensure coverage of all
the edges at once.
•The aim is to cover all possible true/false decisions.
(1)A-2C-3D-E-4G-5H
(2) 1A-2B-E-4F
•Hence Branch Coverage is 2.
Path coverage
Function fn_delete_element (int value, int array_size, int array[])
{
1 int i; location = array_size + 1;
2 for i = 1 to array_size
3 if ( array[i] == value )
4 location = i; end if; end for;
5 for i = location to array_size
6 array[i] = array[i+1]; end for;
7 array_size --;
}
Path Coverage
The Flow Graph of the Function/Program under consideration as
shown below:
Cyclomatic complexity
•Cyclomatic complexity is a software metric used to measure the
complexity of a program. These metric, measures independent paths
through program source code.
•Independent path is defined as a path that has at least one edge
which has not been traversed before in any other paths.
•Mathematically, it is set of independent paths through the graph
diagram. The complexity of the program can be defined as -
•V(G) = E - N + 2
•Where,
•E - Number of edges
•N - Number of Nodes
•V (G) = P + 1
•Where P = Number of predicate nodes (node that contains
condition)
Cyclomatic complexity
IF A = 10 THEN
IF B > C THEN
A = B
ELSE A = C
ENDIF
ENDIF
Print A
Print B
Print C
Cyclomatic complexity
Cyclomatic complexity
•The Cyclomatic complexity is calculated using the above
control flow diagram that shows seven nodes(shapes) and
eight edges (lines), hence the cyclomatic complexity is
8 - 7 + 2 = 3
Difference between Black box and White box testing
Black Box testing White Box testing
Black box testing is the Software
testing method which is used to test
the software without knowing the
internal structure of code or program.
White box testing is the software
testing method in which internal
structure is being known to tester who
is going to test the software.
This type of testing is carried out by
testers.
Generally, this type of testing is
carried out by software developers.
Implementation Knowledge is not
required to carry out Black Box
Testing.
Implementation Knowledge is
required to carry out White Box
Testing.
Mainly applicable to higher levels of
testing:Acceptance Testing,
System Testing
Mainly applicable to lower levels of
testing:Unit Testing,
Integration Testing
Advantages of Dynamic testing
•Dynamic Testing can reveal the uncovered defects that are
considered to be too difficult or complicated and which cannot
be covered through static Analysis
•In Dynamic Testing, we execute the software, end to end,
ensuring error free software which in turn increases the quality
of a product and project.
•Dynamic Testing becomes an essential Tool for detecting any
security Threats
Disadvantages of Dynamic testing
•Dynamic Testing is Time Consuming because it executes the
application/software or code which requires huge amount of
Resources
•Dynamic Testing increases the cost of project/product because
it does not start early in the software lifecycle and hence any
issues fixed in later stages can result in an increase of cost.