Chapter 2 Types of Testing
Chapter 2 Types of Testing
Of Testing
White-box testing
White-box testing (also known as clear box
testing, glass box testing, transparent box
testing, and structural testing) is a method of
testing software that tests internal structures
or workings of an application.
In white-box testing an internal perspective
programming languages
Automated tools may provide false positives
document.
Study and discuss the validity of possible
interchanging information.
Technical Review
technical expert.
Goals of technical review
The goal is to evaluate the value of technical
concept in the project environment.
Build the consistency in the use and
1 0 0 0
2 0 1 1
3 1 0 1
4 1 1 1
02. {
06. {
07. k = p[i];
08. j = 1;
10. p[j] = k;
11. }
12. }
01.insertion_procedure (int a[], int p [], int N)
02. {
07. {
12. }
14. }
Now, to calculate the cyclomatic complexity you
use one of three methods:
1.Count the number of regions on the graph: 4
2.No. of predicates (red on graph) + 1 : 3 + 1 = 4
3.No of edges – no. of nodes + 2: 14 – 12 + 2 = 4
McCabe’s Cyclomatic Complexity
Mathematically, the cyclomatic complexity of a
structured program is defined with reference to the
control flow graph of the program, a directed graph
containing the basic blocks of the program, with an edge
between two basic blocks if control may pass from the first
to the second. The complexity CC is then defined as
CC= E − N + 2P,
where
E = the number of edges of the graph.
N = the number of nodes of the graph.
P = the number of connected components.
The graph is strongly connected, and the cyclomatic
complexity of the program is equal to the cyclomatic number
of its graph which is defined as
CC = E − N + P.
Or it can be defined as
CC=D+1
Where D=Number of decision points in the graph
Flow graph notation for a program:
Example :
i = 0;
while (i<n-1) do
j = i + 1;
while (j<n) do
if A[i]<A[j] then
swap(A[i], A[j]);
end do;
i=i+1;
end do;
Flow graph for this program will be
Computing mathematically,
CC = 9 - 7 + 2 = 4
CC= 3 + 1 = 4 (Condition nodes are 1,2
and 3 nodes)
Basis Set - A set of possible execution
path of a program
1, 7
1, 2, 6, 1, 7
1, 2, 3, 4, 5, 2, 6, 1, 7
1, 2, 3, 5, 2, 6, 1, 7
Example :
IF A = 10 THEN
IF B > C THEN
A=B
ELSE
A=C
ENDIF
ENDIF
Print A
Print B
Print C
Advantages of Structural Testing:
automated.
Disadvantages of Structural Testing:
EXAMPLE :
A tester, without knowledge of the internal structures
of a website, tests the web pages by using a browser;
providing inputs (clicks, keystrokes) and verifying the
outputs against the expected outcome.
BLACK BOX TESTING ADVANTAGES
Tests are done from a user’s point of view and
will help in exposing discrepancies in the
specifications.
Tester need not know programming languages
or how the software has been implemented.
Tests can be conducted by a body independent
from the developers, allowing for an objective
perspective and the avoidance of developer-bias.
Test cases can be designed as soon as the
specifications are complete.
BLACK BOX TESTING DISADVANTAGES
Only a small number of possible inputs can be
tested and many program paths will be left
untested.
Without clear specifications, which is the
situation in many projects, test cases will be
difficult to design.
Tests can be redundant if the software
designer/ developer has already run a test case.
Ever wondered why a soothsayer closes the eyes
when foretelling events? So is almost the case in
Black Box Testing.
Techniques For Black Box Testing
1.Requirement Based Testing
4.Decision Tables
5. Equivalence Partitioning
business rules
Way to use decision tables in test
designing
Firstly; get to know a suitable function or
subsystem that acts according to a combination
of inputs or events.
Taken system should be with fewer inputs or
else combinations will become impossible.
Always better to take maximum numbers of
conditions, split them into subsets and use
these subsets one at a time.
After getting features that need to be combined,
add them to a table showing all combinations of
“Yes” and “No” for each of the feature.
Let’s take an example of a finance application, where users pay money
– monthly Repayment or year wise (the term of loan). If user chooses
both options, the system will create a negotiation between two. So,
there are two conditions of the loan amount, mention in the given
below table,
TABLE 1: Blank decision table
Repayment money
has
been mentioned
Terms of loan has
been mentioned
Next, recognize all of the combinations in “Yes” and “No” (In Table 2).
In each column of two conditions mention “Yes” or “No”, user will get
here four combinations (two to the power of the number of things to be
combined). Note, if user has three things to combine, they will have
eight combinations, with four things, there are 16, etc. Because of this,
it’s always good to take small sets of combinations at once. To keep
track on combinations, give alternate “Yes” and “No” on the bottom
row, put two “Yes” and then two “No” on the row above the bottom row,
etc., so the top row will have all “Yes” and then all “No” (Apply the
same principle to all such tables).
TABLE 2: Decision table – Input combination
Process term Y Y
Error message Y
We will provide you some other example that allows the customer to
enter both repayment and term. This will change the outcome of our
table, this will generate an error message if both are entered
Actions/Outcomes
Process term Y
Error message Y Y
The final process of this method is to write test cases to use each of
the four steps in our table.
Conditions Rule 1 Rule 2 Rule 3 Rule 4
Repayment amount has Y Y N N
been entered:
Term of loan has been Y N Y N
entered:
Actions/Outcomes:
Result: Error Process loan Process Error
message amount term message message
Advantage of decision table technique:
The range of input integers can be split into the following partitions :
•Negative Integers: Values between -5 and -1
•Zero (neither positive nor negative)
•Positive Integers: Values between 1 and 5
•Values > 5 (Invalid)
•Values < -5 (Invalid)
1.Any Number greater than 10 entered in the reservation column (let say 11) is
considered invalid.
2.Any Number less than 1 that is 0 or below, then it is considered invalid.
3.Numbers 1 to 10 are considered valid
4.Any 3 Digit Number say 100 is invalid.
6.User Documentation Testing
It is a type of non-functional testing.
Any written or pictorial information describing, defining, specifying,
reporting, or certifying activities, requirements, procedures, or results’.
Documentation is as important to a product’s success as the product itself.
If the documentation is poor, non-existent, or wrong, it reflects on the
quality of the product and the vendor.
As per the IEEE Documentation describing plans for, or results of, the
testing of a system or component, Types include test case specification, test
incident report, test log, test plan, test procedure, test report. Hence the
testing of all the above mentioned documents is known as documentation
testing.
This is one of the most cost effective approaches to testing. If the
documentation is not right: there will be major and costly problems. The
documentation can be tested in a number of different ways to many
different degrees of complexity. These range from running the documents
through a spelling and grammar checking device, to manually reviewing the
documentation to remove any ambiguity or inconsistency.
Documentation testing can start at the very beginning of the software
process and hence save large amounts of money, since the earlier a defect
is found the less it will cost to be fixed.
BENEFITS
Removes Uncertainties
Offer good training material to fresher’s
Good Marketing Strategy
Good Coverage and Estimating the Project’s
Deadline
7.Graph Based Testing