What Is Software Testing?
So, finally we come to the main topic that is software testing itself. You have already understood the meaning of software testing and why it is important while going through the previous sections. Here, from this section onwards we will take an in-depth look at the subject, but before we move on let’s just revise the definition of software testing.
Software testing is nothing but the process of assessing the functionality of software to ensure that it is in line with the requirements of the customer. Testing is broadly classified into:
- Dynamic Testing: carried out by executing the program
- Static Testing: involves examination of code and related documents.
Dynamic and static testing is often used together.
Black Box Testing
Black box testing focuses only on the functionality of the software. The tester does not look into the internal details of the software. Black box testing is carried out at all levels of software testing – unit, integration, system and acceptance.
Black Box Testing
The testing procedures for black box testing are very simple. The tester only focuses on what the software is supposed to do. The tester is not supposed to focus on how the software is managing the function internally. The test cases for black box testing are created keeping only the specifications and requirements in mind. No test case is created to check the internal logic of the software. The tester just feeds in valid and invalid inputs and checks the output for these values.
White Box Testing
Unlike black box testing, white box testing is carried out in depth to the level of the source code. In this form of testing the internal logic, its implementation and working is examined and the test cases are written to check the how the software is working at the internal level. White box testing can be carried out at the level of unit, integration and system level. White box testing is often used to detect internal design errors which are otherwise very difficult to uncover however, this form of testing does not check for missing requirements or specifications.
White Box Testing
Statement Coverage
Statement coverage is a form of testing in which code is tested in such a way that each statement of the code is executed at least once. The idea behind this form of testing is to ensure that every statement in every block of code is executed at least once and the results are observed. This form of testing is also referred to as line coverage or segment coverage form of testing.
The point to be noted here is that every statement is executed once which means that there may be some conditions in some blocks that may not get tested in this manner. Therefore there is a possibility that some errors may go undetected in statement coverage process.
Decision Coverage
Decision coverage or branch coverage deals with testing of all true and false conditions of the code. The reason why it is also called branch coverage is because a branch is an outcome of decision. It is considered to be a more effective form of testing than simple statement coverage. A decision statement can be:
- An IF statement
- A loop control statement such as do-while
- A statement that can have two or more outcomes also known as CASE statement.
The good thing about decision coverage is that you are able to validate all branches in the code and it is able to check the efficiency of the code in a better manner than statement coverage approach.
Condition Coverage
Condition coverage testing is carried out to check conditions which are generally Boolean expressions and provide result in TRUE or FALSE. Condition coverage may or may not cover the entire decision coverage. In this process only those conditions that return true or false are tested. The expressions that returns a Boolean condition generally plays a very important role in the final decision. This is the reason why condition coverage testing is carried out.
Decision / Condition Coverage
As the name suggests decision/condition coverage methodology includes testing all decisions and all the logical conditions with all possible scenarios that can generate a true or false outcome. It is considered to be a very strong way of testing software.
Multiple Condition Coverage
Multiple condition coverage or condition combination coverage is carried out to check output for multiple combinations of conditions. For example:
If (x=true OR y=true)
Then
Print (“Hello”)
Else
Print (“Bye”)
Here, in this case there are four possible condition combinations:
Testcase1: x=true; y=true
Testcase2: x=true; y=false
Testcase3: x=false; y=true
Testcase4: x=false; y=false
Similarly, for 3 expressions there will be 8 combinations of conditions.