Chapter 3 Functional (Black Box) Testing
Chapter 3 Functional (Black Box) Testing
3
Dynamic Testing Techniques
◦ Dynamic testing involves execution of the test object (application) on a
computer.
5
Chapter 3
Functional (Black Box) Testing
6
Specification-Based / Black Box Testing Technique
◦ Specification-based testing technique, also known as the black box/functional
testing technique uses the software’s external descriptions such as the
technical specifications,
design,
customer requirements, etc.
◦ This implies that a tester who does not have any knowledge about the code or
internal structure can also perform the test.
7
Black Box Testing
In black box testing items are treated as black, whose logic is
unknown.
All that is known is what's goes in and what comes out. the
input and the output
It enables the software engineer to derive sets of input
conditions that will fully exercise all functional requirements
for a program.
◦ The idea behind this technique is to divide/partition a set of test conditions into groups or sets that
can be considered the same or equivalent. This is used for reducing the total number of test cases to
a finite set of testable test cases.
◦ One test value is picked from each class while testing. This is because we are assuming that all the
conditions in one partition will be treated in the same way by the software.
10
...E P
◦ If one condition in a partition works, we assume all of the conditions in that
partition will work and if one condition fails, it is assumed that all others in the
partition will fail and there is no point in testing others.
◦ In this technique, you divide the set of test conditions into a partition that can be
considered the same.
◦ It divides the input data of software into different equivalence data classes.
◦ You can apply this technique, where there is a range in input field.
11
Note: Two test values are equivalent if the
EP…
specification says that the program handles them
in the same way
14
2. Boundary Value Analysis (BVA)
◦ BVA is based on testing the boundary values of valid and invalid partitions.
◦ The behavior at the edge of each equivalence partition is more likely to be
incorrect than the behavior within the partition, so boundaries are an area
where testing is likely to yield defects.
◦ Every partition has its maximum and minimum values and these maximum and
minimum values are the boundary values of a partition.
◦ When designing test cases, a test for each boundary value is chosen.
◦ This technique determines whether a certain range of values are acceptable by
the system or not. It is very useful in reducing the number of test cases.
16
…BVA
◦ Here, the assumption is that if the program works correctly for
these extreme cases, then it will work correctly for all values in
between the valid partition.
◦ Testing has shown that defects that arise when checking a range of
values the most defects are near or at the boundaries.
17
BVA…
◦ For each boundary, we test +/-1 in the least significant digit of either
side of the boundary.
◦ Boundary value analysis can be applied at all test levels.
◦ Example: Assume, we have to test a field which accepts Age between 18 – 56,
• Min-1
• Min
• Min+1
• Max-1
• Max
• Max+1
18
Example 2
◦ How do you do BVA for the range between 10-20?
◦ But as you know we use equal class partitioning also for minimizing our test cases.
◦ Hence, it could be enough to test for 9,10 and 20,21 only. These 4 test cases are
sufficient to test the range, because we get both valid and invalid test case from
these 4 values.
19
…BVA
◦ Test Case 1: Enter the value 9
20
3. Decision Table Testing
◦ A decision table is a tabular representation of inputs versus
rules/cases/test conditions.
◦ Decision table testing is a testing technique used to test a system for different
input combinations.
◦ This is a systematic approach where the different input combinations and their
corresponding system outputs are captured in a tabular form.
◦ That is why it is also called as a Cause-Effect table where causes and effects
are captured for better test coverage.
21
Decision…
◦ It also helps in better test coverage for complex business logic.
◦ The significance of this technique becomes immediately clear as the number of
inputs increases.
25
Let's create the decision table for
this case.
Conditions Case 1 Case 2 Case 3 Case 4 Case 5 Case 6 Case 7 Case 8
Format .jpg .jpg .jpg .jpg Not .jpg Not .jpg Not .jpg Not .jpg
Size Less than Less than More than More than Less than Less than More than More than
32kb 32kb 32kb 32kb 32kb 32kb 32kb 32kb
resolution 137*177 Not 137*177 Not 137*177 Not 137*177 Not
137*177 137*177 137*177 137*177
Output Photo Error Error Error Error Error Error Error
uploaded message message message message message message message
resolution size size and for format format and for format for format,
mismatch mismatch resolution mismatch resolution and size size, and
mismatch mismatch mismatch resolution
mismatch
26
For this condition, we can create 8 different test cases and ensure complete coverage based on the above
table.
1. Upload a photo with format '.jpg', size less than 32kb and resolution 137*177 and click on upload.
Expected result is Photo should upload successfully
2. Upload a photo with format '.jpg', size less than 32kb and resolution not 137*177 and click on upload.
Expected result is Error message resolution mismatch should be displayed
3. Upload a photo with format '.jpg', size more than 32kb and resolution 137*177 and click on upload.
Expected result is Error message size mismatch should be displayed
4. Upload a photo with format '.jpg', size less than 32kb and resolution not 137*177 and click on upload.
Expected result is Error message size and resolution mismatch should be displayed
5. Upload a photo with format other than '.jpg', size less than 32kb and resolution 137*177 and click on
upload. Expected result is Error message for format mismatch should be displayed
6. Upload a photo with format other than '.jpg', size less than 32kb and resolution not 137*177 and click
on upload. Expected result is Error message format and resolution mismatch should be displayed
7. Upload a photo with format other than '.jpg', size more than 32kb and resolution 137*177 and click on
upload. Expected result is Error message for format and size mismatch should be displayed
8. Upload a photo with format other than '.jpg', size more than 32kb and resolution not 137*177 and
click on upload. Expected result is Error message for format, size and resolution mismatch should
be displayed
27
Advantages of decision table testing
◦ When the system functions differently, for different inputs and not
the same for a range of inputs, both equivalent partitioning, and
boundary value analysis won't help, but decision table can be used.
◦ The representation is simple so that it can be easily interpreted and
is used for development and business as well.
◦ This table will help to make effective combinations and can ensure
a better coverage for testing.
◦ Any complex business conditions can be easily turned into decision
tables
◦ In case we are going for 100% coverage typically when the input
combinations are low, this technique can ensure the coverage.
28
4. State Transition Testing
◦ In state transition testing technique, changes in input conditions cause state
changes in the application under test.
◦ In this technique, the tester analyzes the behavior of an application under test
for different input conditions in a sequence.
◦ The tester provides both positive and negative input test values and record the
system behavior.
◦ Any system where you get a different output for the same input, depending on
what has happened before, is a finite state system.
◦ This technique is helpful where you need to test different system transitions.
29
State…
◦ When to use state transition?
◦ When the tester is trying to test sequence of events that occur in the application under test i.e.,
allow the tester to test the application behavior for a sequence of input values.
◦ When the system under test has a dependency on the events/values in the past.
◦ This can be used when a tester is testing the application for a finite set of input values.
30
Four components of State Transition Model
There are 4 main components of the State Transition Model as below
31
Example 1
◦ Let's consider an ATM system function where if the State transition diagram
user enters the invalid password three times, the
account will be locked.
◦ In this system,
◦ If the user enters a valid password in any of the first three
attempts the user will be logged in successfully.
◦ If the user enters the invalid password in the first or
second, the user will be asked to re-enter the password.
◦ And finally, if the user enters incorrect password 3rd time,
the account will be blocked.
◦ In the diagram whenever the user enters the correct
PIN he/she moved to Access Granted state, and if
he/she enters the wrong password he/she is moved
to next trial and if he/she does the same for the 3rd
time, the account blocked state is reached.
32
5. Use Case Testing
◦ Use Case Testing, is a technique that helps identify test cases that
cover the entire system on a transaction by transaction basis from
start to the finishing point.
◦ The method of deriving the test condition from use case is known
as use case testing. The test cases designed as per the type of
method execute the different business scenarios and user
functionalities.
◦ In a use-case, an actor is represented by "A" and system by "S".
First, we list the Main Success Scenario.
◦ A use case is a description of a particular use of the system by an
actor or user. It is used widely in developing tests at system or
acceptance level.
33
…Use Case
Main Success Scenario Step Description
A:Actor 1 A: Enter Agent Name & Password
S:System
2 S: Validate Password
3 S: Allow Account Access
34
…Use Case
◦ Consider the first step of an end to end scenario for a login functionality for a Flight
Reservation application where the Actor enters Agent Name and Password to login
into the Flight Reservation application.
36