Software Testing is evaluation of the software against requirements gathered from users and system specifications. Testing is conducted at the phase level in software development life cycle or at module level in program code. Software testing comprises of Validation and Verification.
Software Verification deals by Developer
Verification is the process of confirming if the software is meeting the business requirements, and is developed adhering to the proper specifications and methodologies.
• Verification ensures the product being developed is according to design specifications.
• Verification answers the question– "Are we developing this product by firmly following all design specifications ?"
• Verifications concentrates on the design and system specifications.
Software Validation deals by Tester
Validation is process of examining whether the software satisfies the user requirements. It is carried out at the end of the SDLC. If the software matches requirements for which it was made, it is validated.
• Validation ensures the product under development is as per the user requirements.
• Validation answers the question – "Are we developing the product which attempts all that user needs from this software ?".
• Validation emphasizes on user requirements.
Target of the test are -
Errors- These are actual coding mistakes made by developers. In addition, there is a difference in output of software and desired output, is considered as an error.
Fault - When error exists fault occurs. A fault, also known as a bug, is a result of an error which can cause system to fail.
Failure - failure is said to be the inability of the system to perform the desired task. Failure occurs when fault exists in the system.
Testing Approaches :
Tests can be conducted based on two approaches 1. Functionality testing or Black-Box testing
2. Implementation testing or White-Box testing
When functionality is being tested without taking the actual implementation in concern it is known as black-box testing. The other side is known as white-box testing where not only functionality is tested but the way it is implemented is also analyzed.
Black-box testing :
It is carried out to test functionality of the program and also called ‘Behavioral’ testing. The tester in this case, has a set of input values and respective desired results. On providing input, if the output matches with the desired results, the program is tested ‘ok’,
Black-box testing techniques:
In this testing method, the design and structure of the code are not known to the tester, and testing engineers and end users conduct this test on the software.
Equivalence class -
The input is divided into similar classes. If one element of a class passes the test, it is assumed that all the class is passed.
Boundary values -
The input is divided into higher and lower end values. If these values pass the test, it is assumed that all values in between may pass too.
Cause-effect graphing -
In both previous methods, only one input value at a time is tested. Cause (input) – Effect (output) is a testing technique where combinations of input values are tested in a systematic way.
Pair-wise Testing -
The behavior of software depends on multiple parameters. In pairwise testing, the multiple parameters are tested pairwise for their different values.
State-based testing -
The system changes state on provision of input. These systems are tested based on their states and input.
White-box testing techniques:
It is conducted to test program and its implementation, in order to improve code efficiency or structure. It is also known as ‘Structural’ testing.
In this testing method, the design and structure of the code are known to the tester. Programmers of the code conduct this test on the code.
A. Control-flow Testing
The purpose of the control-flow testing to set up test cases which covers all statements and branch conditions. The branch conditions are tested for both being true and false, so that all statements can be covered.
B. Control Structure Testing
Control structure testing is a part of White Box Testing. It includes the following methods:
- Conditional Testing
- Loop Testing
- Data Validation Testing
- Branch Testing/Path Testing
1. Conditional Testing
It is an approach to design test cases to exercise the logical conditions contained in a program module of an application.
2. Loop Testing
Loop testing is a white box testing technique that focuses exclusively on the validity of a loop construct.
Types of Loops
a) Simple Loop
b) Nested Loop
c) Concatenated Loop
d) Unstructured Loop
a) Simple Loop Testing
A simple loop is tested in the following way:
a. Skip the entire loop.
b. Make 1 pass through the loop.
c. Make 2 passes through the loop.
d. Make m passes through the loop where m<n, n is the maximum number of passes through the loop.
e. Make n, n-1, n+1 passes through the loop.
b) Nested Loop Testing
A nested loop is tested in the following way.
a. Start the innermost loop.
b. Conduct a simple loop test for the innermost loop.
c. Work outward, conducting a test for the next loop keeping all other loops at a minimum.
d. Continue until all the loops are tested.
c) Concatenated Loop Testing
To test the concatenated loops, the procedure is if the loops are independent then test them as simple loops otherwise test them as nested loops.
d) Unstructured Loop Testing
To test the unstructured loops we needs to restructure their design.
3. Data Validation Testing
In data validation testing it selects the test paths of a program according to the locations of definitions in the program.
In this type of testing the each statement in a program is assigned a unique statement number and each function does not modify its parameter or global variables.
In this type of testing the tester checks for the data which is calculated during the navigation on a different page and it is also known as data flow.
4. Branch Testing/Path Testing
A branch is the outcome of a decision, so branch testing simply measures which decision outcomes have been tested. In this testing it takes a more in-depth view of the source code.
Data-flow testing -
This testing technique emphasis to cover all the data variables included in the program. It tests where the variables were declared and defined and where they were used or changed.
Path Testing :
• Path Testing is another white box testing technique first proposed by Tom McCabe, which focuses in identifying independent paths in a program.
• The idea is to design test cases to exercise all independent paths at least once during testing.
• A easy way to identify paths in the program is the control flow graph ( CFG ).
• CFG (control flow graph) describes the flow of control in the program through program graph which consists of finite set of nodes and a finite set of directed edges.
• The nodes represent the executable blocks or the lines in the program .
• The edges represent flow of controls.
• CFG(control flow graph) mainly involves sequence, selection and iterative representation in the program flow.
Cyclomatic Complexity Model :
• It is also called conditional complexity and used to indicate the complexity of the given program.
• It was developed by Thomas J McCabe in 1976.
• It is computed using the control flow graph of the given program using the formula :
Cyclomatic Complexity Model (M) = E – N + 2P
Example 1:
Cyclomatic Complexity Model (M) = E – N + 2P
where E=8,N=7,P=1
(M) = 8 – 7 + 2*1
(M) = 1 + 2
(M) = 3
In the above example, we can see there are few conditional statements that is executed depending on what condition .Here there are 3 paths of condition that need to be tested to get the output.
Path 1 : 1,2,3,5,6,7
Path 2 : 1,2,4,5,6,7
Path 3 : 1,6,7
Example 2:
Cyclomatic Complexity Model (M) = E – N + 2P
where E = edge or Number of Edges in the control flow graph
E = 8
N = node or Number of Nodes in the control flow graph
N = 7
P =Number of connected components or Predicate node or Number of Nodes in the exit points
P = 1 ( for single Program the value of p=1)
Therefore the Cyclomatic Complexity Model (M) is
M = E – N + 2P
M = 8 – 7 + 2*1
M = 1 + 2
M = 3