White Box Testing

White box testing is a software testing technique where, the internal structure, design, coding and all the events are tested. As the name says, white box, which means whatever in the box that is, the software is visible to the tester.

This testing technique deals with the verification of how the flow of the input leads to the output. With the analysis of the data path through the functions or the modules, it also focuses on strengthing the security, improving the usability and furnishing the design of the software.

white-box-testing-demo

White box testing is referred to by different names. Such as clear box testing or the Open box testing. All of which means, that all the internal modules are seen or visible to the tester. White box testing is performed by a set of developers.

Before we proceed in this article, it is important to know, that what are the different sections or modules on which the white box testing is going to be performed. Those are listed below:

  • The flow of inputs which are tricky or are very specific to invoke its related functions.
  • The functionalities of the loops which are conditionals.
  • Testing of all statements, codes or external modules that supports them.
  • The path which is not complete and has some critical logics which are hard to understand.

It should be noted that this testing, can be done in different levels of software developments. This testing can be carried out taken the system into the account as a whole to test.

Also, it may be carried out in a very smaller level like the unit testing, or the integration testing which is comparatively higher. This testing is direct, carried out on the statement, codes or the function module itself. And the actual output is compared with the expected output.

Error Guessing Technique

The Process of White box Testing

Below is a diagram which shows the representative diagram of the white box testing:

white-box-testing

As shown in the above diagram, white box testing can be divided into two types. One is the Unit testing and the other is the integration testing.

The unit testing is further divided into Execution Testing, Operation testing, and mutation testing.

And the integration testing divided into the top-down approach, bottom-up approach and hybrid approach.

Execution testing can be further divided into statement coverage, branch coverage, and path coverage.

Smoke testing Vs Sanity testing

Unit Testing

Unit Testing is the process of testing a module, at a time. In this testing, one unit, that is the smallest functional unit of the software is tested at a time. To perform a unit test, unit test cases are developed and is performed by the developer or the tester who has good command over programming.

As shown in the diagram unit test can be further divided into three different types. They are:

  • Execution Testing
  • Operation Testing
  • Mutation Testing

Execution Testing:

Execution Testing is the process of directly executing the code and compare the output to the expected result. To carry out this kind of testing, the tester must have good knowledge of coding or programming and the test case must be developed after a thorough study of the codes.

This testing can be further classified into three different types:

  • Statement Coverage
  • Branch Coverage
  • Path Coverage
Statement Coverage:

In this test, we are concern whether all the statements are covered while performing the software test. In this test, this has to assure that whether all the statements has been covered or executed at least once. For example, for example of an if-else, where we have multiple statements for different conditions.

The test case must be designed in such a way, that all the multiple blocks also get a chance to execute at least once.

This test only assures that all the statement is covered just once, but does not lay emphasis on the different conditions on when the statement gets executed.

It should be noted that a similar statement may execute differently and have different outputs based on different conditions. But, this is not a concern in statement coverage.

Branch Coverage:

In this test, we are concern whether all the branches are covered while performing the test. It is almost the same as that of the statement coverage also.

The only difference is that in statement coverage all statement has to be covered at least once, on the other hand, in branch coverage, the output of all the branch is checked whether returning true or false, but both should be reached.

It is strictly checked here how the same statement performs differently for different conditions. It may be needed to execute the same statement for more than 100 times, but all different outputs will be checked.

Path Coverage:

In this test, it is checked whether all the paths are covered at least once. This is mainly a detailed task to test how a function performed as the data flows from it. It mainly checks from the function start to the exit point.

It is important to note that, both the concept of statement testing and the branch coverage is performed in this testing technique. The test cases for this technique is also, designed in such a way that it traverses all loops and reach up to the final output covering all the statements.

Operation Testing:

Operational testing is the process of testing mainly the non-functional elements of the unit modules. The non-functional attributes may include, performance, efficiency, load balancing capacity, resource usability, network, security, etc.

Mutation Testing:

Mutation testing is a very different kind of testing. In mutation testing, we intentionally, change some of the codes and replace it with a different statement or code, which is very hard to identify when the system runs as a whole.

And then the test case is applied in these modified units, and it is observed whether the test cases are able to detect those error which is induced intentionally.

In this technique, our next important goal is to break the code block into smaller parts, so that is can be integrated after removing the redundancy.

What is Beta Testing?

Integration Testing

In this technique, the unit functions are integrated and are tested together. Integration testing is done before the system testing and after all the unit tests are carried out successfully. Integration testing is done at the lower levels and then is carried out to the upper level.

There are three approaches for performing the integration testing:

  • Top-Down Approach
  • Bottom-Up Approach
  • Hybrid Approach

Top-Down Approach:

In this type of integration testing, the testing is carried out at the upper levels and then it is brought at the levels and then up to the unit levels. This objective for carrying out this testing is that the whole system is checked when the testing is done at the upper level.

Then when the testing is brought at the lower level, then it is checked how the smaller aggregate functions are working.

Then testing is carried at the unit levels which is also called the root or the leaf level of the software.

Bottom-Up Approach :

In this type of testing, the modules at the lower levels are tested at first, if the result comes satisfactory, then only the test is made to be carried out at a higher level. At last, the testing is carried out at the topmost level which is somewhat similar to the system testing.

It may be noted that, in this testing technique, modules or units in one level is tested at a time. And modules of one level is not mixed with the modules of a different level, while the testing is carried out.

Hybrid Approach:

In this type of integration testing, modules or units of one level may be tested with a different module which belongs to a different level. The hybrid approach is the most used approach, as there may be some functional dependencies between the functions, which may be important and must be tested.

This testing ensures that all the modules or functions which are interlinked with each other are testing is the same way as if they are in the real working environment. This helps to understand the product output better.

What is a Software Testing Metric?

Advantages of White Box Testing

  • As this testing deals with the codes and hidden functions, therefore it is possible to optimize the code inside the software.
  • White box testing can be carried out with the automation tool, as there are now many tools available, which can directly scan the codes.
  • This testing can be carried out when the GUI of the software is not still developed, as it deals with coding only, and not with the interface for input of the data.
  • White box testing can be useful, as branch coverage and statement coverage is going to be carried out as the testing goes on.

Some method for Agile Testing

Disadvantages of White Box Testing

  • White box testing requires a good grasp of programming knowledge, as the tester is going to deal with the codes only and not with the interface.
  • White box testing may not be feasible if the application is large enough.
  • In white box testing, there may be a requirement of changes in codes, which may result in the need for the total scenario change of the system.
  • In white box testing, generally emphasis is laid on codes, so in the testing, if the changes are done frequently, then the test cases which are generated for the system testing may be obsolete.
  • In white box testing, it may take time to develop test cases, which cannot be estimated.

What is volume Testing?

Summary

White box testing is a software testing type in which the internal codes, programs, architecture and structure of the software is tested.

White box testing can be applied to different levels of testing, such as unit testing, integration testing as system testing as well. It is advisable to carry out all the white box testings in the unit and integration levels only, which reduces the risk, cost, time and effort in the later phases of testing.

Unit Testing can be further classified into mutation testing, operating testing and execution testing. On the other hand, integration testing can be further classified as, bottom-up approach, top-down approach, and hybrid approach.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions