Unit - 3 Black-Box Testing
Unit - 3 Black-Box Testing
1
Outline:
2
How do you test a system?
3
Specification Based Testing
Classification based on the source of information to derive test cases:
Input
determined by... Result
Actual
output
… requirements* Black box compared
with
* from previous phase required
4
Specification Based Testing
⚫ There are numerous forms of testing all with a slightly different purpose and focus.
• Black box tests are normally based on requirements and the functionality
specified in them.
• Their purpose is to confirm that a given input reliably produces the anticipated
output condition.
• This testing process is performed by quality assurance (QA) teams.
5
Specification Based
Testing
White Box Testing
• White box testing is based on the knowledge of the internal logic of an application’s
code and includes tests such as coverage of code statements, branches, paths, and
conditions.
• This testing process is generally performed by software developers by using a
targeted set of prearranged test cases. The purpose of white box testing is to confirm
internal integrity and logic of the artifact and code.
The aim of this testing is to search for the defects, if any, due to improper structure or
improper usage of applications. A gray-box tester partially knows the internal structure,
which includes access to the documentation of internal data structures as well as the
algorithms used. Gray-box testers require both high-level and detailed documents
6 describing the application, which they collect in order to define test cases.
Black, Gray and White-box Testing
White box
Confirmation
…design of
expected
elements behavior
7
Characteristics of Testable Software
Operable: The better it works (i.e., better quality), the easier it is to test
Simple: The program should exhibit functional, structural, and code simplicity
Stable: Changes to the software during testing are infrequent and do not
⚫ In this method, tester selects a function and gives input value to examine its
functionality, and checks whether the function is giving the expected output
or not. If the function produces the correct output, then it is passed in testing,
otherwise failed. The test team reports the result to the development team
and then tests the next function. After completing testing of all functions if
there are severe problems, then it is given back to the development team for
correction.
9
Generic Steps of Black Box Testing
• The black box test is based on the specification of requirements, so it is examined in
the beginning.
• In the second step, the tester creates a positive test scenario and an adverse test
scenario by selecting valid and invalid input values to check that the software is
processing them correctly or incorrectly.
• In the third step, the tester develops various test cases such as decision table, all
pairs test, equivalent division, error estimation, cause-effect graph, etc.
• The fourth phase includes the execution of all test cases.
• In the fifth step, the tester compares the expected output against the actual output.
• In the sixth and final step, if there is any flaw in the software, then it is cured and
tested again.
10
Black Box Testing Steps
• Black box testing involves testing external interfaces to ensure
that the code meets functional and nonfunctional requirements.
The various steps involved in black box testing are the following:
1. Create test plans
13
13
Cont.…
Testing for various types of inputs. After ensuring that the application block
exposes the interfaces that address all of the functional specifications, you
need to test the robustness of these interfaces.
You need to test for the following input types:
• Randomly generated input within a specified range
• Boundary cases for the specified range of input
• The number zero testing if the input is numeric
• The null input
• Invalid input or input that is out of the expected range
14
14
Perform load testing Load test the application block to analyze the behavior at
various load levels.
• This ensures that it meets all performance objectives that are stated as
requirements.
Perform stress testing Stress test the application block to analyze various
bottlenecks and to identify any issues visible only under extreme load conditions,
such as race conditions and contentions.
Perform security testing Test for possible threats in deployment scenarios.
• Deploy the application block in a simulated target environment and try to
hack the application by exploiting any possible weakness of the application
block.
Perform globalization testing Execute test cases to ensure that the application
block can be integrated with applications targeted toward locales other than the
default locale used for development.
15
15
Test
Procedure
⚫ The test procedure of black box testing is a kind of process in which the tester
has specific knowledge about the software's work, and it develops test cases
to check the accuracy of the software's functionality.
⚫ It does not require programming knowledge of the software. All test cases are
how the result is arising. There are various techniques used in black box
testing for testing like decision table technique, boundary value analysis
technique, state transition, All-pair testing, cause-effect graph technique,
equivalence partitioning technique, error guessing technique, use case
technique and user story technique.
16
Test
Cases
⚫ Test cases are created considering the specification of the requirements.
⚫ These test cases are generally created from working descriptions of the
valid input values and adverse test scenarios by taking invalid input values to
determine the correct output.
⚫ Test cases are mainly designed for functional testing but can also be used for
non-functional testing.
⚫ Test cases are designed by the testing team, there is no any involvement of
17
Test Case Design Techniques
⚫ The test case design technique or methods or approaches are need to be
followed by every test engineer while writing the test cases to achieve
the maximum test coverage. If we follow the test case design technique,
then it became process-oriented rather than person-oriented.
⚫ The test case design technique ensures that all the possible values that
are both positive and negative are required for the testing purposes. In
software testing, there are three major test case design techniques which
are as follows:
1. Error Guessing
2. Equivalence Partitioning
1: Error Guessing
19
1. Error Guessing
• In this section, we will see the first test case design technique that is Error guessing
techniques.
• Error guessing is a technique in which there is no specific method for identifying the error.
It is based on the experience of the test analyst, where the tester uses the experience to
guess the problematic areas of the software.
• It is a type of black box testing technique which does not have any defined structure to
find the error.
• In this approach, every test engineer will derive the values or inputs based on their
understanding or assumption of the requirements, and we do not follow any kind of rules
to perform error guessing technique.
• The accomplishment of the error guessing technique is dependent on the ability and
product knowledge of the tester because a good test engineer knows where the bugs are
20
most likely to be, which helps to save lots of time.
Examples of Error guessing method:
⚫ The equivalence partitions are derived from the requirements and specifications of
the software. The advantage of this approach is, it helps to reduce the time of testing
due to a smaller number of test cases from infinite to finite. It is applicable at all
levels of the testing process.
22
Guidelines for Defining Equivalence Classes
• If an input condition specifies a range, one valid and two invalid
equivalence classes are defined
Input range: 1 – 10 Eq classes: {1..10}, {x < 1}, {x > 10}
• If an input condition requires a specific value, one valid and two invalid
equivalence classes are defined
Input value: 250 Eq classes: {250}, {x < 250}, {x > 250}
• If an input condition is a Boolean value, one valid and one invalid class
are define
Input: {true condition} Eq classes: {true condition}, {false condition}
23
Examples of Equivalence Partitioning technique
Assume that there is a function of a software application that accepts a particular number of
digits, not greater and less than that particular number. For example, an OTP number which
contains only six digits, less or more than six digits will not be accepted, and the application
will redirect the user to the error page.
24
Examples of Equivalence Partitioning technique
⚫ A function of the software application accepts a 10 digit mobile
number.
25
Examples of Equivalence Partitioning technique
⚫ In both examples, we can see that there is a partition of two equally valid and invalid
partitions, on applying valid value such as OTP of six digits in the first example and
mobile number of 10 digits in the second example, both valid partitions behave same,
i.e. redirected to the next page.
⚫ Another two partitions contain invalid values such as 5 or less than 5 and 7 or more
than 7 digits in the first example and 9 or less than 9 and 11 or more than 11 digits in
the second example, and on applying these invalid values, both invalid partitions
behave same, i.e. redirected to the error page.
⚫ We can see in the example, there are only three test cases for each example and that is
also the principal of equivalence partitioning which states that this method intended
to reduce the number of test cases.
26
3. Boundary Value Analysis
⚫ Boundary value analysis is one of the widely used test case design technique for black
box testing. It is used to test boundary values because the input values near the
boundary have higher chances of error.
⚫ Whenever we do the testing by boundary value analysis, the tester focuses on, while
entering boundary value whether the software is producing correct output or not.
⚫ Boundary values are those that contain the upper and lower limit of a variable. Assume
that, age is a variable of any function, and its minimum value is 18 and the maximum
value is 30, both 18 and 30 will be considered as boundary values.
⚫ The basic assumption of boundary value analysis is, the test cases that are created using
boundary values are most likely to cause an error.
27
3. Boundary Value Analysis
⚫ The 18 and 30 are the boundary values that's why tester pays more attention to these
values, but this doesn't mean that the middle values like 19, 20, 21, 27, 29 are ignored.
Test cases are developed for each and every value of the range.
Testing of boundary values is done by making valid and invalid
partitions. Invalid partitions are tested because testing of
output in adverse conditions is also essential.
Example:
⚫ If the software which is under test, follows all the testing guidelines and
specifications then it is sent to the releasing team otherwise to the
development team to fix the defects.
29
Boundary Value Analysis
When the programming element is a range type, we can arrive at test cases using BVA
as follows:
30
Guidelines for Boundary Value Analysis
• If an input condition specifies a range bounded by values a and b, test cases
should be designed with values a and b as well as values just above and just
below a and b
• Apply guidelines 1 and 2 to output conditions; produce output that reflects the
minimum and the maximum values expected; also test the values just below
and just above
31
4. Decision Table Technique in Black Box Testing
⚫ Decision table technique is one of the widely used test case design techniques for
black box testing. This is a systematic approach where various input combinations
and their respective system behaviorare captured in a tabularform.
⚫ That's why it is also known as a cause-effect table. This technique is used to pick the
test cases in a systematic manner; it saves the testing time and gives good coverage
to the testing area of the software application.
⚫ Decision table technique is appropriate for the functions that have a logical
relationship between two and more than two inputs.
⚫ This technique is related to the correct combination of inputs and determines the
result of various combinations of input. To design the test cases by decision table
technique, we need to consider conditions as input and actions as output.
32
…..Decision Table Technique in Black Box Testing
⚫ Most of us use an email account, and when you want to use an email
account, for this you need to enter the email and its associated password.
⚫ If both email and password are correctly matched, the user will be directed
to the email account's homepage; otherwise, it will come back to the login
page with an error message specified with "Incorrect Email" or "Incorrect
Password."
⚫ Now, let's see how a decision table is created for the login function in
which we can log in by using email and password. Both the email and the
password are the conditions, and the expected result is action.
33
…..Decision Table Technique in Black Box
Testing
⚫ In the table, there are four conditions or test cases to test the login function. In the
first condition if both email and password are correct, then the user should be
directed to account's Homepage.
⚫ In the second condition if the email is correct, but the password is incorrect then the
function should display Incorrect Password. In the third condition if the email is
incorrect, but the password is correct, then it should display Incorrect Email.
⚫ Now, in fourth and last condition both email and password are incorrect then the
function should display Incorrect Email.
⚫ In this example, all possible conditions or test cases have been included, and in the
same way, the testing team also includes all possible test cases so that upcoming
bugs can be cured at testing level.
⚫ In order to find the number of all possible conditions, tester uses 2n formula where n
denotes the number of inputs; in the exampl the number of inputs is 2 (one is true
and second is false).
⚫ Number of possible conditions = 2^ Number of Values of the second condition
⚫ Number of possible conditions =2^2 = 4
⚫ While using the decision table technique, a tester determines the expected output, if
the function produces expected output, then it is passed in testing, and if not then
it is failed. Failed software is sent back to the developmentteam to fix the defect.
3
4
Black Box Testing
Advantages Disadvantages
Well suited and efficient for large Limited coverage, since only a selected
code segments. number of test scenarios is actually
performed.
Large numbers of moderately skilled The test cases are difficult to design.
testers can test the application with
no knowledge of implementation,
programming language, or operating
systems.
3
5
36