Types of Testing
Types of Testing
Types of Testing
Types of Testing
White-Box Testing:-
Definition:-
“White-box testing is a testing technique that examines the program
structure and derives test data from the program logic/code. The other names of
glass box testing are clear box testing, open box testing, logic driven testing or path
driven testing or structural testing.”
“White-Box Testing is the testing of a software solution's internal coding
and infrastructure. It focuses primarily on strengthening security, the flow of inputs
and outputs through the application, and improving design and usability. White
box testing is also known as clear box testing, open box testing, logic driven
testing or path driven testing or structural testing and glass box testing.”
White-box testing is based on the inner workings of an application and
revolves around internal testing. The term "white-box" was used because of the
see-through box concept. The clear box or white box name symbolizes the ability
to see through the software's outer shell (or "box") into its inner workings.
The testing can be done at system, integration and unit levels of software
development. One of the basic goals of white-box testing is to verify a working
flow for an application. It involves testing a series of predefined inputs against
expected or desired outputs so that when a specific input does not result in the
expected output, you have encountered a bug.
Classification of White-Box testing:-
2. The author:
As the writer of the „document under review‟, the author‟s basic goal should
be to learn as much as possible with regard to improving the quality of the
document. The author‟s task is to illuminate unclear areas and to understand
the defects found.
3. The scribe:
The scribe (or recorder) has to record each defect found and any suggestions
or feedback given in the meeting for process improvement.
4. The reviewers:
The role of the reviewers is to check defects and further improvements in
accordance to the business specifications, standards and domain knowledge.
Walkthroughs:-
To present the documents both within and outside the software discipline in
order to gather the information regarding the topic under documentation.
To explain or do the knowledge transfer and evaluate the contents of the
document.
To achieve a common understanding and to gather feedback.
To examine and discuss the validity of the proposed solutions.
Technical review:-
A technical review is a discussion meeting that focuses on technical content
of a document. it is led by a trained moderator, but also can be led by a technical
expert. Compared to inspections, technical reviews are less formal and there is
little or no focus on defect identification on the basis of referenced documents. The
experts that are needed to be present for a technical review can be architects, chief
designers and key users. It is often performed as a peer review without
management participation.
It is less formal review.
It is led by the trained moderator but can also be led by a technical expert.
It is often performed as a peer review without management participation.
Defects are found by the experts (such as architects, designers, key users) who
focus on the content of the document.
In practice, technical reviews vary from quite informal to very formal.
To ensure that an early stage the technical concepts are used correctly.
To access the value of technical concepts and alternatives in the product.
To have consistency in the use and representation of technical concepts.
To inform participants about the technical content of the document.
Inspection:-
It helps the author to improve the quality of the document under inspection.
It removes defects efficiently and as early as possible.
It improves product quality.
It creates common understanding by exchanging information.
It learn from defects found and prevent the occurrence of similar defects.
Structural Testing:-
“Structural testing, also known as glass box testing or white box testing is
an approach where the tests are derived from the knowledge of the software's
structure or internal implementation.”
The other names of structural testing include clear box testing, open box
testing, logic driven testing or path driven testing.
Advantages:
Forces test developer to reason carefully about implementation
Spots the Dead Code or other issues with respect to best programming
practices.
Disadvantages:
Expensive as one has to spend both time and money to perform white box
testing.
Test cases for input box accepting numbers between 1 and 1000 using
Boundary value analysis:
1) Test cases with test data exactly as the input boundaries of input domain i.e.
values 1 and 1000 in our case.
2) Test data with values just below the extreme edges of input domains i.e. values
0 and 999.
3) Test data with values just above the extreme edges of input domain i.e. values 2
and 1001.
Boundary value analysis is often called as a part of stress and negative testing.
Note: There is no hard-and-fast rule to test only one value from each equivalence
class you created for input domains. You can select multiple valid and invalid
values from each equivalence class according to your needs and previous
judgments.
E.g. if you divided 1 to 1000 input values in valid data equivalence class, then you
can select test case values like: 1, 11, 100, 950 etc. Same case for other test cases
having invalid data classes.
This should be a very basic and simple example to understand the Boundary value
analysis and Equivalence partitioning concept.
As an example, consider a printer that has an input option of the number of copies
to be made, from 1 to 99. To apply boundary value analysis, we will take the
minimum and maximum (boundary) values from the valid partition (1 and 99 in
this case) together with the first or last value respectively in each of the invalid
partitions adjacent to the valid partition (0 and 100 in this case). In this example we
would have three equivalence partitioning tests (one from each of the three
partitions) and four boundary value tests. Consider the bank system described in
the previous section in equivalence partitioning.
Equivalence Partitioning:-
Equivalence partitioning is a software technique that involves identifying a
small set of representative input values that produce as much different output
condition as possible. This reduces the number of permutation & combination of
input, output values used for testing, thereby increasing the coverage and reducing
the effort involved in testing.
The set of input values that generate one single expected output is called a
partition. When the behavior of the software is the same for a set of values, then
the set is termed as equivalence class or partition.
Example: An insurance company that has the following premium rates based on
the age group. A life insurance company has base premium of $0.50 for all ages.
Based on the age group, an additional monthly premium has to pay that is as listed
in the table below. For example , a person aged 34 has to pay a premium=$0.50 +$
1.65=$2.15
Age group Additional Premium
Under 35 $ 1.65
35-59 $ 2.87
60+ $ 6.00
Based on the equivalence portioning technique, the equivalence partitions that are
based
Next we will identify all of the combinations of True and False (see Table 4.3).
With two conditions, each of which can be True or False, we will have four
combinations (two to the power of the number of things to be combined). Note that
if we have three things to combine, we will have eight combinations, with four
things, there are 16, etc. This is why it is good to tackle small sets of combinations
at a time. In order to keep track of which combinations we have, we will alternate
True and False on the bottom row, put two Trues and then two Falses on the row
above the bottom row, etc., so the top row will have all Trues and then all Falses
(and this principle applies to all such tables).
TABLE 4.3 Decision table with input combinations:
Conditions Rule 1 Rule 2 Rule 3 Rule
4
Repayment amount has T T F F
been entered:
Term of loan has been T F T F
entered:
In the next step we will now identify the correct outcome for each combination
(see Table 4.4). In this example, we can enter one or both of the two fields. Each
combination is sometimes referred to as a rule.
Actions/Outcomes
Process loan amount: Y Y
Process term: Y Y
At this point, we may realize that we hadn‟t thought about what happens if the
customer doesn‟t enter anything in either of the two fields. The table has
highlighted a combination that was not mentioned in the specification for this
example. We could assume that this combination should result in an error message,
so we need to add another action (see Table 4.5). This highlights the strength of
this technique to discover omissions and ambiguities in specifications. It is not
unusual for some combinations to be omitted from specifications; therefore this is
also a valuable technique to use when reviewing the test basis.
TABLE 4 . 5 Decision table with additional outcomes:
Conditions Rule 1 Rule 2 Rule 3 Rule
4
Repayment amount has T T F F
been entered:
Term of loan has been T F T F
entered:
Actions/Outcomes
Process loan amount: Y Y
Process term: Y Y
Error message:
Y
Now, we make slight change in this example, so that the customer is not allowed to
enter both repayment and term. Now the outcome of our table will change, because
there should also be an error message if both are entered, so it will look like Table
4.6.
Actions/Outcomes
Process loan amount: Y
Process term: Y
Error message: Y Y
You might notice now that there is only one „Yes‟ in each column, i.e. our actions
are mutually exclusive – only one action occurs for each combination of
conditions. We could represent this in a different way by listing the actions in the
cell of one row, as shown in Table 4.7. Note that if more than one action results
from any of the combinations, then it would be better to show them as separate
rows rather than combining them into one row.
Actions/Outcomes:
Result: Error Process loan Process Error
message amount term message
The final step of this technique is to write test cases to exercise each of the four
rules in our table.
Now let’s see the decision table for credit card shown above:
Note that we have put X for the discount for two of the columns (Rules 1 and
2) – this means that this combination should not occur. You cannot be both a
new customer and also holding a loyalty card as per the conditions mentioned
above. Hence there should be an error message stating this.
We have made an assumption in Rule 3. Since the coupon has a greater
discount than the new customer discount, we assume that the customer will
choose 20% rather than 15%. We cannot add them, since the coupon cannot be
used with the „new customer‟ discount as stated in the condition above. The
20% action is an assumption on our part, and we should check that this
assumption (and any other assumptions that we make) is correct, by asking the
person who wrote the specification or the users.
For Rule 5, however, we can add the discounts; since both the coupon and the
0%.
If we are applying this technique thoroughly, we would have one test for each
column or rule of our decision table. The advantage of doing this is that we may
test a combination of things that otherwise we might not have tested and that could
find a defect. However, if we have a lot of combinations, it may not be possible or
sensible to test every combination. If we are time-constrained, we may not have
time to test all combinations. Don‟t just assume that all combinations need to be
tested. It is always better to prioritize and test the most important combinations.
Having the full table helps us to decide which combinations we should test and
which not to test this time. In the example above all the conditions are binary, i.e.
they have only two possible values: True or False (or we can say Yes or No).
State Based Testing: - State Based means change of sate from one state to
another. State based Testing is useful to generate the test cases for state
machines as it has a dynamic behavior (multiple state) in its system. We Can
explain this using state transition diagram. It is a graphic representation of a state
machine.
For example we can take the behavior of mixer grinder. The state transition for
this will be like
Each represents a state of machine. Like this we can draw state transition
diagram. Valid test cases can be generated by: