Home Cover Discussion Others
Software engineering
Department of
Software
engineering 4th
Year
Software testing
and quality Presented by: Demeke M.
MEKDELA AMBA U.
assurance
Home Cover Discussion Others
Software engineering
Chapter three
Functional (Black Box)
Testing
Presented by: Demeke M.
MEKDELA AMBA U.
Home Intro. Discussion Others
Software testing 3
Static and dynamic
1. Static analysis testing
• It is the process of examining the code, documentation, or any artifacts related to the
software without actually executing the program.
• Reviews code without running or executing(running the code) it.
• Assess error early in the verification phase/development cycle.
• Examples: Code review, inspection, and algorithm analysis.
2. Dynamic analysis
• It involves executing the software to validate its behavior. It is done during the later
stages of development when the software is in a working state.
• Runs software to check for failures.
• Assess error early in the validation phase.
• One observe some representative program behavior, and reach conclusion about the
quality of the system.
o In this chapter we are going to learn about Dynamic testing techniques.
Home Intro. Discussion Others
Software testing 4
Cont.
…
Home DT. Discussion
Software testing Others 5
Dynamic testing
o Dynamic testing is carried out during the validation process.
o Based on “how test are designed?” dynamic testing can be classified
into
1. Specification-based (black-box) also known as behavioral techniques
2. Structure-based (white-box or structural techniques)
3. Experience-based (Reading assignment)
Home BBT. Discussion Others
Software testing 6
Black box testing technique
o Also called Functional testing or Behavioral testing.
o It also known as specification-based testing technique uses the
software’s external descriptions such as the
• technical specifications,
• design,
• customer requirements, etc.
o This implies that a tester who does not have any knowledge about the code or
internal structure can also perform the test.
Home BBT. Discussion
Software testing Others 7
Cont. …
o In black box testing items are treated as black whose logic is unknown.
o All that is known is what's goes in and what comes out. The input and output
o 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
Home BBT. Discussion Others
Software testing 8
Why use black box testing?
o Tests from a user’s perspective—ensures software behaves as expected.
o No need for programming knowledge—testers don’t analyze code.
o Faster test case development—as soon as requirements are ready, testing
can begin.
o Detects missing features, incorrect functionality, and UI issues.
Home BBT. Discussion
Software testing Others 9
Black box testing technique
o 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
o The following method are used in Black Box testing methods
1. Equivalence partitioning
2. Boundary-value analysis
3. Decision table testing
4. State transition testing
5. Use Case Testing
Home EP. Discussion
Software testing Others 1
0
1. Equivalence Partitioning (EP)
o Equivalent partitioning or Equivalent Class Partitioning (ECP) is a process of
classifying the test cases and grouping them into different categories or classes.
o 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.
o 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.
Home EP. Discussion
Software testing Others 1
Cont. … 1
o The class can be divided into two types, valid class and invalid class. All the
classes which fall under valid type are values that satisfy the condition. Classes
that do not satisfy the condition fall under the invalid class.
o 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.
o Instead of testing all values, test one value from each partition.
o The main objective is to reduce the number of test cases by dividing input data
into partitions that are expected to produce similar results.
Home EP. Discussion Others
Software testing 1
Cont. 2
o Example Let's say we have a login system where the …
password
must be
1 :
between 8 and 12 characters long, and it can only contain letters (uppercase or
lowercase) and numbers. We can test this by using Equivalence Partition method
o Valid Partition: Passwords that meet the criteria of 8 to 12 characters
long, containing only letters and numbers.
• Example: "Pass1234" (9 characters)
• Example: "1234abcd" (8 characters)
• Example: "ABCD567890" (10 characters)
o Invalid Partition (too short): Passwords that are less than 8 characters.
• Example: "Pass1" (5 characters)
Home EP. Discussion
Software testing Others 1
Cont. … 3
o Invalid Partition (too long): Passwords that are longer than 12
characters.
• Example: "Password123456" (15 characters)
o Invalid Partition (invalid characters): Passwords containing special characters
or spaces (not allowed).
• Example: "Pass@123" (contains special character @)
o Invalid Partition (numbers only): Passwords that contain only
numbers (this may be considered invalid depending on the system's password
policy).
• Example: "12345678" (8 characters, but only numbers)
Home EP. Discussion Others
Software testing 1
Cont. 4
o To cover the partitions, we would create test cases like: …
• Valid partition: Test with password "Pass1234" (valid)
• Invalid partition (too short): Test with password "abc" (invalid)
• Invalid partition (too long): Test with password "Password123456" (invalid)
• Invalid partition (special characters): Test with password "Pass@123" (invalid)
• Invalid partition (only numbers): Test with password "12345678" (invalid)
o By testing these cases, we’re covering the most likely scenarios for this
system, allowing us to minimize the number of tests while still ensuring robust
testing.
Home EP. Discussion
Software testing Others 1
Cont. … 5
o Example 2: Examine the ticket booking functionality in a flight
reservation
application. The system only accepts valid ticket quantities between 1 and 10. By
apply Equivalence Partitioning (EP) techniques to test this behavior?
Home BVA. Discussion
Software testing Others 1
6
2. Boundary Value Analysis (BVA)
o BVA is based on testing the boundary values of valid and invalid partitions.
o 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.
o Every partition has its maximum and minimum values and these maximum and
minimum values are the boundary values of a partition.
o 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.
Home BVA. Discussion
Software testing Others 1
Cont. … 7
o Tests can be designed to cover both valid and invalid boundary values.
o When designing test cases, a test for each boundary value is chosen.
o 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.
o Boundary value analysis is most common when checking a range of
numbers.
o We should design test cases which exercise the program
functionality at the
boundaries, with values just inside and just outside the boundaries.
Home BVA. Discussion
Software testing Others 1
Cont. … 8
o 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.
o Testing has shown that defects that arise when checking a range of values, the
most defects are near or at the boundaries.
Home BVA. Discussion
Software testing Others 1
Cont. … 9
o Example 1: let see an example of BVA in banking account system where the
system allows a user to withdraw money within a specific range called 200 to
5,000 birr.
o 1st find the boundary value. In this case the valid rage of boundary value are
• Lower boundary: 200
• Upper boundary: 5,000
o 2nd find inside the boundary value:
• Just above the lower boundary: Test with 210 (a valid withdrawal amount, just
above the lower boundary).
• Just below the upper boundary: Test with 4990 (a valid withdrawal amount, just
below the upper boundary).
Home BVA. Discussion Others
Software testing 20
Cont.
o 3rd find outside the boundary: …
• Just below the lower boundary: Test with 90 (an invalid withdrawal amount, just
below the lower boundary).
• Just above the upper boundary: Test with 5,010 (an invalid withdrawal amount,
just above the upper boundary).
o 4th Edge case for multiples of 10: :
• Test with an amount that’s not a multiple of $10: Test with $105 (invalid because
it’s not a multiple of $10).
Home BVA. Discussion Others
Software testing 2
Cont. 1
o Summary of …
result Test case Value Expected result
Lower boundary 200 Valid
Upper boundary 5000 Valid
Just inside lower boundary 210 Valid
Just inside upper boundary 4490 Valid
Just outside lower boundary 190 Invalid
Just outside upper boundary 5010 Invalid
Not a multiple of 10 (edge case) 205 Invalid
Home BVA. Discussion
Software testing Others 22
Cont.
Class … exercise
o If the system is a user input form that only accepts ages between 18 and
56 test this system using BVA method?
Home BVA. Discussion Others
Software testing 23
Cont.
o Here is the answer …
• Min-1
• Min
• Min+1
• Max-1
• Max
• Max+1
Home DDT. Discussion
Software testing Others 24
3. Decision Table Testing
o Decision Table Testing is a Black Box testing technique used to handle complex
business logic or decision-making processes in software applications. It is
particularly useful when there are multiple conditions (inputs) that lead to
different outcomes (actions).
o Decision table testing is a testing technique used to test a system for different input
combinations.
o This is a systematic approach where the different input combinations and
their corresponding system outputs are captured in a tabular form.
o That is why it is also called as a Cause-Effect table where causes and effects are
captured for better test coverage.
Home DDT. Discussion
Software testing Others 25
Cont. …
o The significance of this technique becomes immediately clear as the
number of
inputs increases.
o Number of possible combinations is given by 2n , where n is the number of inputs.
o 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
Home DDT. Discussion
Software testing Others 26
Cont.
o Example 1: let us test login screen using DTT. …
o 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.
Home DDT. Discussion Others
Software testing 2
Cont. 7
Conditions Case 1 Case 2 Case 3 Case 4 …
Username (T/F) F T F T
Password (T/F) F F T T
Output (E/H) E E E H
o Legend:
• T – Correct
username/password
• F – Wrong username/password
• E – Error message is displayed
• H – Home screen is displayed
Home DDT. Discussion Others
Software testing 28
o Interpretation:
Cont.
… message.
• Case 1 – Username and password both were wrong. The interface show an error
• Case 2 – Username was correct, but the password was wrong. The UI show an error message.
• Case 3 – Username was wrong, but the password was correct. The UI show an error message.
• Case 4 – Username and password both were correct, and the user navigated to homepage
o 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
Home DDT. Discussion
Software testing Others 29
Cont. …
o Example 2: let us test “Upload photo” using DTT.
o Nowconsider 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.
o 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 updated
successfully
Home DDT. Discussion Others
Software testing 30
Cont.
o Let create DTT for the above 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 Less than Less than More More than
32kb 32kb 32kb than 32kb 32kb 32kb than 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 and for for format,
mismatch mismatch resolution format resolution format size, and
mismatch mismatch mismatch and size resolution
mismatch mismatch
Home DDT. Discussion
Software testing Others 3
Cont. … 1
o 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
Home DDT. Discussion Others
Software testing 32
Advantage of DTT
o 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.
o The representation is simple so that it can be easily interpreted and is used for
development and business as well.
o This table will help to make effective combinations and can ensure a better coverage
for testing
o Any complex business conditions can be easily turned into decision tables
o In case we are going for 100% coverage typically when the input combinations are
low, this technique can ensure the coverage
Home STT. Discussion
Software testing Others 33
4. State Transition Testing
o In state transition testing technique, changes in input conditions cause
state changes in the application under test.
o In this technique, the tester analyzes the behavior of an application under test for
different input conditions in a sequence.
o The tester provides both positive and negative input test values and record
the system behavior.
o Any system where you get a different output for the same input, depending
on what has happened before, is a finite state system.
o This technique is helpful where you need to test different system transitions.
Home STT. Discussion Others
Software testing 34
Cont.
o When to use state transition?
…
• When the tester is trying to test sequence of events that occur in the
application under test i.e., this will 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.
o 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
Home STT. Discussion
Software testing Others 35
Four Parts of State Transition Model
There are 4 main components of the State Transition Model as
below
Home STT. Discussion Others
Software testing 36
Cont.
o Example: Let's consider an ATM system function where if …user enters
the the
invalid password three times, the account will be locked.
o 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.
Home STT. Discussion Others
Software testing 37
Cont.
o State transition diagram …
Home UCT. Discussion
Software testing Others 38
5. Use Case Testing
o It involves validating the system's functionality based on real-world scenarios, or "use
cases," that describe how a user interacts with the system to achieve specific goals.
o 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.
o It follow list of step to achieve the functional requirement of the system. These steps
define the interactions between the actor and the system.
o It defines the outcomes of errors during system use.
Home UCT. Discussion
Software testing Others 39
Cont. …
o In a use-case, an actor is represented by "A" and system by "S". First, we list
the Main Success Scenario.
Home UCT. Discussion Others
Software testing 40
Cont.
o Example 2: Use Case: Cash Withdrawal from ATM …
o The step to test the above example using Use case test technique are
• Identify Actors
• List use case
• Set pre condition
• Main Flow (Normal Scenario):
• Alternative Flows (Exceptional or Alternative Scenarios):
• Test each test case design
Home Topic Discussion Others
Software testing 4
1
Have a nice week !