0% found this document useful (0 votes)
6 views36 pages

Chapter 3 Functional (Black Box) Testing

Dynamic testing is a technique that involves executing an application to validate its behavior against expected outputs, focusing on functional performance. It includes various test design techniques such as specification-based (black-box), structure-based (white-box), and experience-based methods. Key black-box testing methods discussed include equivalence partitioning, boundary value analysis, decision table testing, and state transition testing, each serving to identify errors based on different testing strategies.

Uploaded by

Dani Abera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views36 pages

Chapter 3 Functional (Black Box) Testing

Dynamic testing is a technique that involves executing an application to validate its behavior against expected outputs, focusing on functional performance. It includes various test design techniques such as specification-based (black-box), structure-based (white-box), and experience-based methods. Key black-box testing methods discussed include equivalence partitioning, boundary value analysis, decision table testing, and state transition testing, each serving to identify errors based on different testing strategies.

Uploaded by

Dani Abera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Dynamic Testing Techniques

3
Dynamic Testing Techniques
◦ Dynamic testing involves execution of the test object (application) on a
computer.

◦ This testing technique is also called execution technique or validation testing.


◦ Dynamic testing is performed in runtime environment. When the code being
executed, input with a value, the result or the output of the code is checked and
compared with the expected output. With this we can observe the functional
behavior of the software, monitor the system memory, CPU response time,
performance of the system.
4
…Dynamic
◦ Dynamic testing is carried out during the validation process.

◦ Dynamic test design techniques can be further classified into:

1. Specification-based (black-box, also known as behavioral techniques)

2. Structure-based (white-box techniques)

3. Experience-based (Reading assignment)

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.

Focuses on the functional requirement of the software also called


behavioral testing
8
Black Box Testing
 Black-box testing is not an alternative to white-box techniques but it is
complementary approach.
 Black-box testing attempts to find errors in the following categories:
 Incorrect or missing functions
 Interface errors
 Errors in data structures or external data base access.
 Behavior or performance errors
 Initialization and termination errors.
 Commonly used Black Box testing methods :
1. Equivalence partitioning
2. Boundary-value analysis
3. Decision table testing
4. state transition testing
5. Use Case Testing
9
1. Equivalence Partitioning (EP)
◦ Equivalent partitioning or Equivalent Class Partitioning (ECP) is a black box testing technique
(code is not visible to tester) which can be applied to all levels of testing like unit, integration,
system and UAT.

◦ 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

Example 1: Equivalent partitioning

◦ Let's consider the behavior of tickets in


the flight reservation application, while
booking a new flight.
◦ Ticket values 1 to 10 are considered
valid & ticket is booked. While value 11
to 99 are considered invalid for
reservation and error message will
appear, "Only ten tickets may be
ordered at one time."
12
EP…
◦ Here is the test value
1. Any number greater than 10 entered in the reservation column (let’s 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.
◦ We cannot test all the possible values because if done, the number of
test cases will be more than 100.
◦ To address this problem, we use equivalence partitioning
hypothesis where we divide the possible values of tickets into
groups or sets as shown above where the system behavior can be
considered the same.
13
EP…
◦ The divided sets are called
Equivalence Partitions or
Equivalence Classes.
◦ Then we pick only one value from
each partition for testing.
◦ The hypothesis behind this technique
is that if one condition/value in a
partition passes all others will also
pass.
◦ Likewise, if one condition in a
partition fails, all other conditions in
that partition will fail.

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.

◦ A boundary value for a valid partition is a valid boundary value. Similarly a


boundary value for an invalid partition is an invalid boundary value.
15
…BVA
◦ Tests can be designed to cover both valid and invalid boundary values.

◦ 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.

◦ Boundary value analysis is most common when checking a range of numbers.


◦ We should design test cases which exercise the program functionality at the
boundaries, with values just inside and just outside the boundaries.

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?

◦ The boundary value analysis can have 6 test case data.

◦ Min-1, Min, Min+1 for the lower limit: 9, 10, 11

◦ Max-1, Max, Max+1 for the upper limit: 19, 20, 21

◦ 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

◦ Test Case 2: Enter the value 10

◦ Test Case 3: Enter the value 20

◦ Test Case 4: Enter the value 21

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.

◦ Number of possible combinations is given by 2n , where n is the number of inputs.


◦ For n = 10, which is very common in the web based testing, having big input
forms, the number of combinations will be 1024. Obviously, you cannot test all
but you will choose a rich sub-set of the possible combinations using decision

based testing technique


22
Example 1
◦ Let's create a decision table for a login
screen.
◦ The condition is simple if the user
provides correct username and
password, the user will be redirected
to the homepage. If any of the input is
wrong, an error message will be
displayed.
Conditions Case 1 Case 2 Case 3 Case 4
◦ Legend:
Username (T/F) F T F T
◦ T – Correct username/password
◦ F – Wrong username/password Password (T/F) F F T T
◦ E – Error message is displayed Output (E/H) E E E H
◦ H – Home screen is displayed
33
23
…Decision table testing
◦ Interpretation:
◦ Case 1 – Username and password both were wrong. The user is shown an error message.
◦ Case 2 – Username was correct, but the password was wrong. The user is shown an error message.
◦ Case 3 – Username was wrong, but the password was correct. The user is shown an error message.
◦ Case 4 – Username and password both were correct, and the user navigated to homepage
◦ While converting this to test case, we can create 2 scenarios,
◦ Check the system with correct username and correct password and click on login, and the expected
result will be -the user should be navigated to homepage
◦ And one from the below scenario
◦ Check the system with wrong username and wrong password and click on login, and the expected result will
be- the user should get an error message
◦ Check the system with correct username and wrong password and click on login, and the expected
result will be- the user should get an error message
◦ Check the system with wrong username and correct password and click on login, and the expected result will
be- the user should get an error message
24
Example 2
◦ Decision Table for “Upload photo”
◦ Now consider a dialogue box which asks the user to upload photo with certain
conditions like
1. You can upload only '.jpg' image format
2. File size less than 32kb
3. Resolution 137x177.
◦ If any of the conditions fails, the system will throw a corresponding error
message stating the issue; and if all conditions are met, photo will be uploaded
successfully

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.

◦ When not rely on state transition?


◦ When the testing is not done for sequential input combinations.

◦ If the testing is to be done for different functionalities like exploratory testing

30
Four components of State Transition Model
There are 4 main components of the State Transition Model as below

States States that the software might get


1st Try

Transitions Transition from one state to another

Events Events that origin a transition like closing a


Incorrect Pin
file or withdrawing money
Actions Actions that result from a transition (an Access
error message or being given the cash.) Granted

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

Extensions 2a Password not valid


S :Display Message and ask for re-try 4 times

2b Password not valid 4 times


S :Close Application

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.

◦ In the next step, the system will validate the password


◦ Next, if the password is correct, the access will be granted
◦ There can be an extension of this use case. In case password is not valid, system will
display a message and ask for re-try four times
◦ Or if Password not valid four times, system will close the application
◦ Here we will test the success scenario and one case of each extension.
35
Many thanks!

36

You might also like