KEMBAR78
Structure-Based Test Design 1 | PDF | Software Testing | Computing
0% found this document useful (0 votes)
8 views19 pages

Structure-Based Test Design 1

Uploaded by

spavan85685
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views19 pages

Structure-Based Test Design 1

Uploaded by

spavan85685
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

STRUCTURE-BASED TEST

DESIGN
WHITE BOX TESTING

• White Box Testing : It is a method of software testing that tests internal


structure or working of an application .
Structure-based testing is also known as White box, glass box, clear box .
• The Test case are written by examining the structure of code.
• White Box Testing can be applied at the test level Unit testing, Integration
testing, system testing and acceptance testing.
• Here are some of the top white box testing tools to use: Veracode, CPP unit,
N unit, RCUNIT etc
WHITE BOX TESTING

Input
Internal code
output
WHITE BOX TESTING TEST TECHNIQUE

Some of the White box test design techniques


Code Coverage
Statement Coverage
Decision Coverage
Path Coverage
WHITE BOX TESTING

Code Coverage
This technique is a measure used in software testing. It describes the
degree to which the source code of a program has been tested.
It is a form of testing that inspects the code directly and is therefore a
form of white box testing.
Code coverage of 70-80% is a reasonable goal for system test of most
projects with most coverage metrics. Use a higher goal for projects
specifically organized for high testability or that have a high failure costs.
WHITE BOX TESTING

Minimum code coverage for unit testing can be 10-20% higher than for
system testing.

Code Coverage = (Number of coverage items exercised / Total number


of coverage)x100

Here are some of the top Code Coverage tools that can help
measure/analyze code coverage : Cobertura, Clover, Devpartner, Emma,
Jtest, Kalistick, Co View and Co Ant, Bullseye for C++ & Sonar
WHITE BOX TESTING

Statement Coverage
This technique involves execution of all statements of the source code.
It is used to calculate the total no of executed statements in the source
code out of total statements present in the source code.

Statement coverage= (Number of statements executed/ Total number


of statements )x100%
WHITE BOX TESTING

1) Main()
2) {
3) Int n1,n2,n3:
4) If(n1>=n2&&n1>=n3)
5) Printf(“%d n is the largest number, “n1”);
6) else if (n2 >=n1&&n2>=n3)
7) Printf f(“%d n2 is the largest number, “n2”);
8) else
9) Printf (%d n3 is the largest number, “n3”);
10) }
WHITE BOX TESTING

Decision Coverage:
It is used to cover all conditions.
Decision coverage is also known as predicated coverage. In which each
one of the Boolean expression have been evaluate both True & False.
Decision coverage= (Number of decision coverage executed/ Total
number of decision outcomes )x100%
WHITE BOX TESTING

Example:
Read x;
Read Y;
If x>y
print(“X” is greater than “y”)
End if
WHITE BOX TESTING

• Decision coverage is stronger than Statement coverage.


• 100% decision coverage guarantees 100% statement coverage but
100% statement coverage does not guarantee 100% decision coverage
.
• decision coverage is not suitable for complex item like “if A>10
or(A+B=20) then
WHITE BOX TESTING

Path Coverage:
It is one of the structured testing technique. Path coverage is concerned
with linearly independent paths through the code. Testers draw a control
flow diagram of the code and write Test cases based on the path .
Path coverage we can cover statement coverage, decision coverage.
WHITE BOX TESTING

In this example, there are several possible paths


through the code:
1, 2
1, 3, 4, 5, 6, 8
1, 3, 4, 7, 6, 8
In a path coverage approach, the tester writers
unit tests to execute as many as possible of the
paths through the program’s control flow.
The objective is to identify paths that are broken,
redundant, or inefficient.
ADVANTAGES:

• It helps in finding out defect at an early stage.


• It helps in elimination of dead code.
• It provides thorough testing of the software.
DISADVANTAGES

• In depth Knowledge about the programming language is necessary


• Sometimes it is Expensive
• Requires more time.
STRUCTURE-BASED TEST DESIGN

Questions:
1) Which of the following is the odd one out?
a. white box
b. glass box
c. structural
d. Functional
STRUCTURE-BASED TEST DESIGN

2.Path coverage includes


a) statement coverage
b) condition coverage
c) decision coverage
d) none of these
STRUCTURE-BASED TEST DESIGN

3) Testing techniques that can be used in acceptance testing are

a. Structural

b. Functional

c. A and B
4) Decision Coverage.

a) Testing Boolean expressions which are not in control structures.

b) entire expression is considered as boolean expression irrespective of logical-and and logical-


cooperators

c) coverage except switch-statement cases, exception handlers

d) all of the above.


Thank you

You might also like