White box testing
In case of functional testing, internal implementation of the code is hidden and no details are being tested. In contrast to this white box, testing deals with testing the implementation details of the code.
A program is a group of various structures and structural testing aims to check all the independent structures of the program. Test case selection is based on the internal of modules. This testing is more precise as compared to black box testing.
Using white box testing, the product designer can infer following experiments:-
- Guaranteed that every single free way inside module has been practiced at any rate once.
- Exercise all logical decision on their true and false side.
- Execute all loops at their boundaries and within their operation bounds
- Exercise internal data structure to ensure their validity
Different approaches to white box testing
- Control flow based testing
- Data flow based testing
- Mutation testing
Control flow based testing:-
This technique is based on control graph. The flow graph shows logical condition. We can make flow graph from the source code of a program. A node represents a block of statement. An edge represents a transfer of control. A node that contains condition is referred to as predicate node.
Control flow based testing techniques are:-
- Statement coverage testing
- Branch coverage testing
- Path coverage testing
Statement coverage testing:-
It requires that each state of the program be executed at least once during testing. As such, it requires that the way executed during testing incorporates all the hub of the diagram. This is otherwise called all hubs criteria.
This testing is not very strong and can leave error undetected. No test case is being defined for ensuring the statement evaluated in the condition is false.
Branch coverage testing:-
It requires that each edge in the control flow graph e traversed at least once during testing. In other words, branch coverage requires that each decision in the program be evaluated to true and false values at least once during testing. This is also known as all edges criteria. Branch coverage implies statement coverage.
The problem arises here is when the decision is evaluated from multiple conditions.
Path coverage testing:-
It requires that all possible path in the controlled flow graph be executed at least once during testing. This is called path criteria and testing based on these criteria is often called path testing. Path criteria imply branch criteria.
Data flow based testing:-
This method select test path of a program according to the location of definition and uses of the variables in the program. One simple data flow based testing strategy is the one that requires every data uses a chain to be covered at least once. This testing strategy is called data uses testing strategy.
The software is first treated y using an initial test suite build up from different white box testing strategy. After all the initial testing is complete mutation testing is taken up. The arbitrary idea behind mutation testing is to make few arbitrary changes to a program at a time.
After all the underlying testing is finished change testing is taken up. The self-assertive thought behind transformation testing is to roll out a couple of self-assertive improvements to a program at any given moment Each time the program is changed it is called the mutated program and changes were done is called mutant.
A mutated program is tested against the full test suite of the program. If there exist at least one test case is the test suite for which a mutant gives an incorrect result then the mutant is said to be dead. If the mutant remains alive even after all the test cases have been exhausted, the test data is enhanced to kill the mutant.
The process of generation and killing of mutant can be automated by predefining a set of primitive changes that can be applied to a program.
These primitive changes can be alternatives such as:-
- Changing an arithmetic operator
- Changing the value of constant
- Changing a data type