Case Study White Box Testing
Case Study White Box Testing
Case Study White Box Testing
Coverage
White Box Testing is coverage of the specification in the code:
1. Code coverage
2. Segment coverage: Ensure that each code statement is executed once.
3. Branch Coverage or Node Testing: Coverage of each code branch in from all possible was.
4. Compound Condition Coverage: For multiple conditions test each condition with multiple paths and
combination of the different path to reach that condition.
5. Basis Path Testing: Each independent path in the code is taken for testing.
6. Data Flow Testing (DFT): In this approach you track the specific variables through each possible
calculation, thus defining the set of intermediate paths through the code.DFT tends to reflect dependencies but
it is mainly through sequences of data manipulation. In short, each data variable is tracked and its use is
verified. This approach tends to uncover bugs like variables used but not initialize, or declared but not used,
and so on.
7. Path Testing: Path testing is where all possible paths through the code are defined and covered. It's a time-
consuming task.
8. Loop Testing: These strategies relate to testing single loops, concatenated loops, and nested loops.
Independent and dependent code loops and values are tested by this approach.
Limitations
Not possible for testing each and every path of the loops in the program. This means exhaustive testing is
impossible for large systems.
This does not mean that WBT is not effective. By selecting important logical paths and data structure for
testing is practically possible and effective.
Difference between White Box Testing and Black Box Testing
Given below are few differences between the both:
Black Box Testing White Box Testing
It is a testing method without having knowledge about It is a testing method having knowledge about the
the actual code or internal structure of the application actual code and internal structure of the application
This is a higher level testing such as functional This type of testing is performed at a lower level of
testing. testing such as Unit Testing, Integration Testing
It concentrates on the functionality of the system It concentrates on the actual code – program and its
under test syntax's
Black box testing requires Requirement specification White Box testing requires Design documents with
to test data flow diagrams, flowcharts etc.
White box testing is done by Developers or testers
Black box testing is done by the testers
with programming knowledge.
C=A+B
IF C>100
PRINT “ITS DONE”
ELSE
PRINT “ITS PENDING”
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 the testing of this pseudo code.
TestCase_01: A=33, B=45
TestCase_02: A=25, B=30
With this, we can see that each and every line of the code is executed at least once.
Here are the Conclusions that are derived so far:
Branch Coverage ensures more coverage than Statement coverage.
Branch coverage is more powerful than Statement coverage.
100% Branch coverage itself means 100% statement coverage.
But 100 % statement coverage does not guarantee 100% branch coverage.
Now let’s move on to Path Coverage:
As said earlier, Path coverage is used to test the complex code snippets, which basically involve loop
statements or combination of loops and decision statements.
In order to have the full coverage, we would need following test cases:
TestCase_01: A=50, B=60
TestCase_02: A=55, B=40
TestCase_03: A=40, B=65
TestCase_04: A=30, B=30
So the path covered will be:
Red Line – TestCase_01 = (A=50, B=60)
Blue Line = TestCase_02 = (A=55, B=40)
Orange Line = TestCase_03 = (A=40, B=65)
Green Line = TestCase_04 = (A=30, B=30)
Veracode's white box testing tools will help you in identifying and resolving the software flaws quickly and
easily at a reduced cost. It supports several application languages like .NET, C++, JAVA etc and also enables
you to test the security of desktop, web as well as mobile applications. Still, there are several other benefits of
Veracode tool. For detailed information about Veracode White box test tools, please check the below link.
2) EclEmma
EclEmma was initially designed for test runs and analysis within the Eclipse workbench. It is considered to
be a free Java code coverage tool and has several features as well. To install or know more about EclEmma
please check out the below link.
3)RCUNIT
A framework which is used for testing C programs is known as RCUNIT. RCUNIT can be used accordingly
based on the terms of the MIT License. It is free to use and in order to install or know more about it, please
check the below link.
4) cfix
cfix is one of the unit testing frameworks for C/C++ which solely aims at making test suites development as
simple and easy as possible. Meanwhile, cfix is typically specialized for NT Kernel mode and Win32. To
install and know more about cfix, please check out the below link
5) Googletest
Googletest is Google's C++ test framework. Test Discovery, Death tests, Value-parameterized tests, fatal &
non-fatal failures, XML test report generation etc are few features of GoogleTest but there are several other
features too. Linux, Windows, Symbian, Mac OS X are few platforms where GoogleTest has been used. In
order to Download, please check the below link.
6) EMMA
Emma is an easy to use free JAVA code coverage tool. It includes several features and benefits. To Download
and know more about Emma, please check the below link.
7) NUnit
NUnit is an easy to use open source unit testing framework which does not require any manual intervention
to judge the test results. It supports all .NET languages. It also supports data-driven tests and tests run parallel
under NUnit. Earlier releases of NUnit used NUnit license but NUnit 3 is released under the MIT license. But
both the licenses allow free use without any restrictions. In order to download and know more about NUnit
please check the below link.
8) CppUnit
CppUnit is a unit testing framework written in C++ and is considered to be the port of JUnit. The test output
for CppUnit may be either in the XML or text format. It creates unit tests with its own class and runs tests in
the test suites. It is licensed under LGPL. In order to download and know more about CppUnit please check
the below link.
9) JUnit
JUnit is a quiet simple unit testing framework that supports test automation in Java Programming Language.
It mainly supports in Test Driven Development and provides the Test coverage report as well. It is licensed
under Eclipse Public License. For free download and in order to know more about JUnit please check the
below link.
10) JsUnit
JsUnit is considered to be the port of JUnit to javascript. And it is an open source unit testing framework to
support Client sided Javascript. It is licensed under GNU Public License 2.0, GNU Lesser Public License 2.1
and Mozilla Public License 1.1. In order to download and know more about JsUnit please check the below
link.
Conclusion
Relying only on black box testing is not sufficient for maximum test coverage.
We need to have a 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. It’s also good for testers
to participate in this testing as it can provide the most “unbiased” opinion about the code. :)