0
How many types and Techniques of White Box Testing?

Open 1 Answers 41 Views Technology
How many types and Techniques of White Box Testing?

1 Answer

0

There are several types and different methods for each white box testing type.

See the below image for your reference.

<!--[if gte vml 1]> <![endif]--><!--[if !vml]-->image<!--[endif]-->

.

3 Main White Box Testing Techniques:

  1. Statement Coverage
  2. Branch Coverage
  3. Path Coverage

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.

Let’s understand these techniques one by one with a simple example.

#1) Statement coverage:

In a programming language, a 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 a running mode.

Hence “Statement Coverage”, as the name itself suggests, it is the method of validating whether each and every line of the code is executed at least once.

#2) Branch Coverage:

“Branch” in a programming language is like the “IF statements”. An IF statement has two branches: True and False.

So in Branch coverage (also called Decision coverage), we validate whether each branch is executed at least once.

In case of an “IF statement”, there will be two test conditions:

  • One to validate the true branch and,
  • Other to validate the false branch.

Hence, in theory, Branch Coverage is a testing method which is when executed ensures that each and every 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 than Branch coverage. This technique is useful for testing the complex programs.

Let’s take a simple example to understand all these white box testing techniques.

Also check => Different Types of testing

White Box Testing Example

Consider the below simple pseudocode:

<p class="MsoNormal" style="margin-bottom:.25in;line-height:normal;tab-stops
by (277k points)
...