Black-Box Testing: Test Procedures
Black-Box Testing: Test Procedures
Black-box diagram
Black-box testing is a method of software testing that examines the functionality of an application
without peering into its internal structures or workings. This method of test can be applied to virtually
every level of software testing: unit, integration, system and acceptance. It typically comprises most
if not all higher level testing, but can also dominate unit testing as well.
Test procedures
Specific knowledge of the application's code/internal structure and programming knowledge in
general is not required. The tester is aware of what the software is supposed to do but is not aware
of how it does it. For instance, the tester is aware that a particular input returns a certain, invariable
output but is not aware of how the software produces the output in the first place.[1]
Test cases
Test cases are built around specifications and requirements, i.e., what the application is supposed to
do. Test cases are generally derived from external descriptions of the software, including
specifications, requirements and design parameters. Although the tests used are
primarily functional in nature, non-functional tests may also be used. The test designer selects both
valid and invalid inputs and determines the correct output, often with the help of an oracle or a
previous result that is known to be good, without any knowledge of the test object's internal
structure.
Test design techniques
Typical black-box test design techniques include:
All-pairs testing
Equivalence partitioning
Causeeffect graph
Error guessing
Software Testing Help
Search
What is Software Testing All About? (Read This 10 Point Summary Carefully)
In my career so far, I have seen the testers to be the most enthusiastic community in the
software industry.
The reason being, that testers always have something in their scope to learn. Be it domain,
process or technology, a tester can have a holistic development if they wish to.
But as they say There is always a dark side. Testers also avoid one type of testing which
they feel is very complicated and developers piece of cake. Yes, you have guessed it right.
Its the WHITE BOX TESTING.
White box and black box testing:
If we go by definition, White box testing (also known as clear, glass box or structural
testing) is a testing technique which evaluates the code and internal structure of the
program.
In simple words In Black box testing, we test the software from a users point of view, but
in White box, we see and test the actual code. In Black box, we do testing without seeing
the internal system code, but in White box we do see and test the internal code.
White box testing technique is used by both developers as well as testers. It helps them
understand which line of code is actually executed and which is not. This may indicate that
there is either missing logic or a typo, which eventually can lead into some negative
consequences.
Step #1 Understand the functionality of the application through its source code. Having
said that, it simply means that the tester must be well versed with the programming
language and other tools and techniques used to develop the software.
When we discuss about testing, coverage is the most important factor. Here I will explain
how to have maximum coverage in the context of White box testing.
Also read => Cause and Effect Graph Dynamic Test Case Writing Technique For
Maximum Coverage
There are different types and different methods for each white box testing type. See below
image. (click on image to enlarge)
Today, we are going to focus mainly on the execution testing types of Unit testing
white box technique.
1. Statement Coverage
2. Branch Coverage
3. Path Coverage
#1 Statement coverage
In programming language, statement is nothing but the line of code or instruction for the
computer to understand and act accordingly. A statement becomes an executable statement
when it gets compiled and converted into the object code and performs the action when the
program is in running mode.
Hence Statement Coverage, as the name suggests, is the method of validating that each
and every line of code is executed at least once.
#2 Branch Coverage
Hence in theory, Branch Coverage is a testing method which when executed ensures that
each branch from each decision point is executed.
#3 Path Coverage
Path coverage tests all the paths of the program. This is a comprehensive technique which
ensures that all the paths of the program are traversed at least once. Path Coverage is even
more powerful that Branch coverage. This technique is useful for testing the complex
programs.
Lets take a simple example to understand all these white box testing techniques.
INPUT A & B
C = A + B
IF C>100
For Statement Coverage we would need only one test case to check all the lines of code.
That means:
If I consider TestCase_01 to be (A=40 and B=70), then all the lines of code will be executed
Now the question arises:
Is that sufficient?
Because Statement coverage will only cover the true side, for the pseudo code, only one
test case would NOT be sufficient to test it. As a tester, we have to consider the negative
cases as well.
Hence for maximum coverage, we need to consider Branch Coverage, which will
evaluate the FALSE conditions.
In real world, you may add appropriate statements when condition fails.
INPUT A & B
C = A + B
IF C>100
ELSE
Since Statement coverage is not sufficient to test the entire pseudo code, we would require
Branch coverage to ensure maximum coverage.
------------
So for Branch coverage, we would require two test cases to complete testing of this pseudo
code.
TestCase_01: A=33, B=45
With this, we can see that each and every line of code is executed at least once.
As said earlier, Path coverage is used to test the complex code snippets, which basically
involves loop statements or combination of loops and decision statements.
INPUT A & B
C = A + B
IF C>100
END IF
IF A>50
END IF
Simply there are 2 decision statements, so for each decision statement we would need to
branches to test. One for true and other for false condition. So for 2 decision statements, we
would require 2 test cases to test the true side and 2 test cases to test the false side, which
makes total of 4 test cases.
To simplify this lets consider below flowchart of the pseudo code we have:
So, In order to have the full coverage, we would need following test cases:
Conclusion
Note that the statement, branch or path coverage does not identify any bug or defect that
needs to be fixed. It only identifies those lines of code which are either never executed or
remains untouched. Based on this further testing can be focused on.
Relying only on black box testing is not sufficient for maximum test coverage. We need to
have combination of both black box and white box testing techniques to cover maximum
defects.
If done properly, White box testing will certainly contribute to the software quality. Its also
good for testers to participate in this testing as it can provide the most unbiased opinion
About the author: This is a guest article by Shilpa C. Roy. She is working in software
testing field for the past 9 years in domains like Internet advertising, Investment Banking
and Telecom. She has also cleared the CTAL test manager exam with good score.
This is just a start and there is much that can be discussed about this topic. Let us know if
you have any questions about the methods we discussed in this article. Feel free to
suggest more simple or advanced techniques/tools that you are using for doing
white box testing.
21
Cause and Effect Graph Dynamic Test Case Writing Technique For Maximum Coverage
with Fewer Test Cases
21 comments
#1 vismay
Hello Sir,
I am vismay.
I am working as a QA Engineer in company and have 3 years of experience in
manual testing and 6 month experience in automation.
I want to start freelancing please give me suggestions regarding this, how can i start
and prerequisites?
#2 Nikolay
hi
the example shared is very simple and easy to understand clearing all concepts.
thnak you
#4 Ranjan
Very nice.
In the Branch Coverage, the example is incorrect. Psl correct.
In this case, it allways goes to else part, never executed first part.
#5 Kunjal Gandhi
Good one.. Today I get cleared of concept behind 100% branch and statement
coverage
#6 Sumit
#7 Chetan Metker
#9 hritik
In this case, it allways goes to else part, never executed first part.
#11 Andy
A clearer example of when full path should be used would be helpful. Full path can be
extremely time consuming, and so long as full decision and statement coverage has
been achieved, it might also be unnecessary. Typically full path is reserved for safety
or critical systems.
#12 Kelis
#13 Teerna
I read so many stuffs on White Box testing but didnt understand until I read this
article. Thanks! Thorough and easy to understand!
#14 D.Selvakumar
How i can learn this, conducting any course this in Chennai or through online.
#15 nithhya
hi mam nd sir ,ur articleis good nd in my opinion video explanation vil b dam good
than this plz upload video explanation
thank u
Can any one please explain the completely the difference between condition
coverage & path coverage or they are same?
#18 etaert
efteg
#21 Leela
Leave a Comment
Name
Mail
Website (Optional)
Submit