Black Box Testing
BLACK BOX TESTING, also known as Behavioral Testing, is a software
testing method in which the internal structure/design/implementation of
the item being tested is not known to the tester. These tests can be
functional or non-functional, though usually functional.
This method is named so because the software program, in the eyes of
the tester, is like a black box; inside which one cannot see. This method
attempts to find errors in the following categories:
Incorrect or missing functions
Interface errors
Errors in data structures or external database access
Behavior or performance errors
Initialization and termination errors
Definition by ISTQB
black box testing: Testing, either functional or non-functional,
without reference to the internal structure of the component or
system.
black box test design technique: Procedure to derive and/or
select test cases based on an analysis of the specification, either
functional or non-functional, of a component or system without
reference to its internal structure.
Example
A tester, without knowledge of the internal structures of a website, tests
the web pages by using a browser; providing inputs (clicks, keystrokes)
and verifying the outputs against the expected outcome.
Levels Applicable To
Black Box Testing method is applicable to the following levels of software
testing:
Integration Testing
System Testing
Acceptance Testing
The higher the level, and hence the bigger and more complex the box,
the more black-box testing method comes into use.
Techniques
Following are some techniques that can be used for designing black box
tests.
Equivalence Partitioning: It is a software test design technique that
involves dividing input values into valid and invalid partitions and
selecting representative values from each partition as test data.
Boundary Value Analysis: It is a software test design technique that
involves the determination of boundaries for input values and
selecting values that are at the boundaries and just inside/ outside
of the boundaries as test data.
Cause-Effect Graphing: It is a software test design technique that
involves identifying the cases (input conditions) and effects (output
conditions), producing a Cause-Effect Graph, and generating test
cases accordingly.
Advantages
Tests are done from a user’s point of view and will help in exposing
discrepancies in the specifications.
Tester need not know programming languages or how the software
has been implemented.
Tests can be conducted by a body independent from the developers,
allowing for an objective perspective and the avoidance of
developer-bias.
Test cases can be designed as soon as the specifications are
complete.
Disadvantages
Only a small number of possible inputs can be tested and many
program paths will be left untested.
Without clear specifications, which is the situation in many projects,
test cases will be difficult to design.
Tests can be redundant if the software designer/developer has
already run a test case.
Ever wondered why a soothsayer closes the eyes when foretelling
events? So is almost the case in Black Box Testing.
White Box Testing
WHITE BOX TESTING (also known as Clear Box Testing, Open Box
Testing, Glass Box Testing, Transparent Box Testing, Code-Based Testing
or Structural Testing) is a software testing method in which the internal
structure/design/implementation of the item being tested is known to the
tester. The tester chooses inputs to exercise paths through the code and
determines the appropriate outputs. Programming know-how and the
implementation knowledge is essential. White box testing is testing
beyond the user interface and into the nitty-gritty of a system.
This method is named so because the software program, in the eyes of
the tester, is like a white/transparent box; inside which one clearly sees.
Definition by ISTQB
white-box testing: Testing based on an analysis of the internal
structure of the component or system.
white-box test design technique: Procedure to derive and/or
select test cases based on an analysis of the internal structure of a
component or system.
Example
A tester, usually a developer as well, studies the implementation code of
a certain field on a webpage, determines all legal (valid and invalid) AND
illegal inputs and verifies the outputs against the expected outcomes,
which is also determined by studying the implementation code.
White Box Testing is like the work of a mechanic who examines the
engine to see why the car is not moving.
Levels Applicable To
White Box Testing method is applicable to the following levels of software
testing:
Unit Testing: For testing paths within a unit.
Integration Testing: For testing paths between units.
System Testing: For testing paths between subsystems.
However, it is mainly applied to Unit Testing.
Advantages
Testing can be commenced at an earlier stage. One need not wait
for the GUI to be available.
Testing is more thorough, with the possibility of covering most
paths.
Disadvantages
Since tests can be very complex, highly skilled resources are
required, with a thorough knowledge of programming and
implementation.
Test script maintenance can be a burden if the implementation
changes too frequently.
Since this method of testing is closely tied to the application being
tested, tools to cater to every kind of implementation/platform may
not be readily available.
Difference between Black Box testing and White Box
testing
Parameter Black Box testing White Box testing
Definition It is a testing approach which is It is a testing approach in
used to test the software which internal structure is
without the knowledge of the known to the tester.
internal structure of program or
application.
Alias It also knowns as data-driven, It is also called structural
box testing, data-, and testing, clear box testing,
functional testing. code-based testing, or
glass box testing.
Base of Testing is based on external Internal working is known,
Testing expectations; internal behavior and the tester can test
of the application is unknown. accordingly.
Usage This type of testing is ideal for Testing is best suited for a
higher levels of testing like lower level of testing like
System Testing, Acceptance Unit Testing, Integration
testing. testing.
Programming Programming knowledge is not Programming knowledge
knowledge needed to perform Black Box is required to perform
Parameter Black Box testing White Box testing
testing. White Box testing.
Implementati Implementation knowledge is Complete understanding
on knowledge not requiring doing Black Box needs to implement
testing. WhiteBox testing.
Automation Test and programmer are White Box testing is easy
dependent on each other, so it is to automate.
tough to automate.
Objective The main objective of this The main objective of
testing is to check what White Box testing is done
functionality of the system to check the quality of the
under test. code.
Basis for test Testing can start after preparing Testing can start after
cases requirement specification preparing for Detail
document. design document.
Tested by Performed by the end user, Usually done by tester
developer, and tester. and developers.
Granularity Granularity is low. Granularity is high.
Testing It is based on trial and error Data domain and internal
method method. boundaries can be tested.
Time It is less exhaustive and time- Exhaustive and time-
consuming. consuming method.
Algorithm test Not the best method for Best suited for algorithm
algorithm testing. testing.
Code Access Code access is not required for White box testing
Black Box Testing. requires code access.
Thereby, the code could
be stolen if testing is
outsourced.
Benefit Well suited and efficient for It allows removing the
large code segments. extra lines of code, which
can bring in hidden
defects.