Code Coverage in White Box Testing

Good software cannot be achieved without passing the testing and validation stage. Therefore there are some concerns about the actual measurements and assessment criteria of software. Code coverage aims at providing appropriate measure to be used at the testing step of the software in order to assess software. Code coverage tools measure how complete tests exercise code base.

Code coverage

Very often, coders and testers are concerned with the actual mechanisms to measure and assess the source code of their program. In order to address this issue, they make use of several tools. They can use either the Iron Triangle or code coverage tools. In this article, we will focus on the latter choice.

code coverage

Code coverage algorithms were first created to address the problem of assessing a source code by looking directly at the source code. Code coverage belongs to the structural testing category because of the assertions made on the internal parts of the program and not on system outputs. Therefore code coverage aims at finding parts of the code that are not worth testing.

Code Coverage functionalities

In order to assess the source code of a program, suitable criteria first need to be defined. There are five coverage criteria used.

 

  • Functional Coverage:  Aiming at finding how many functions or procedures were executed.
  • Statement or line Coverage:  Which identifies the number of lines in the source code has been executed.
  • Condition Coverage or decision Coverage:  Answers the question about the number of loop conditions were executed in the program.
  • Path Coverage:  Which focuses on finding all possible paths from a given starting point in the code has been executed.
  • Entry and exit Coverage: Which finds how many functions (C/C++, Java) or procedures (Pascal) were executing from the beginning to the end.

It is obvious that some of the criteria mentioned above are linked to each other. For example, the path coverage automatically involves condition, statement and entry/exit coverage. Statement coverage on the other hand does not involve condition coverage.


Also Check:

Leave a Reply

Your email address will not be published. Required fields are marked *