Software Verification Validation and Testing
Software Verification Validation and Testing
Enter 0 to 5 characters in
1 System should not accept
password field
Enter 6 to 10 characters in
2 System should accept
password field
Enter 11 to 14 character in
3 System should not accept
password field
Decision Table based Testing
• Decision tables represent complex logical relationships.
• A Decision Table is a tabular representation of inputs versus
rules/cases/test conditions.
• This testing is a very effective tool in testing the software and its
requirements management.
• The output may be dependent on many input conditions
• Decision tables give a tabular view of various combinations of input
conditions, which are True(T) and False(F).
• Also, it provides a set of conditions and the corresponding actions
required in the testing.
Example 1: How to make Decision Base Table for Login Screen
• The condition is simple if the user provides the correct username and
password the user will be redirected to the homepage. If any of the input
is wrong, an error message will be displayed
Decision table for the problem is:
Conditions Rule 1 Rule 2 Rule 3 Rule 4
Username
F T F T
(T/F)
Password
F F T T
(T/F)
Output
E E E H
(E/H)
Here,
T-True, F-False, E-Error, H-Home Screen
Example 2: How to make Decision Table for Upload Screen
• Now consider a dialogue box that will ask the user to upload a photo with certain conditions
like –
1. You can upload only ‘.jpg’ format image
2. file size less than 32kb
3. resolution 137*177.
• If any of the conditions fails the system will throw a corresponding error
message stating the issue and if all conditions are met photo will be updated
successfully
Decision Table for Example 2:
Conditions Case 1 Case 2 Case 3 Case 4 Case 5 Case 6 Case 7 Case 8
Format .jpg .jpg .jpg .jpg Not .jpg Not .jpg Not .jpg Not .jpg
Size Less than 32kb Less than 32kb >= 32kb >= 32kb Less than 32kb Less than 32kb >= 32kb >= 32kb
resolution 137*177 Not 137*177 137*177 Not 137*177 137*177 Not 137*177 137*177 Not 137*177
• A file must be updated, if the character in the first column is either "A" or "B" and in the second
column it should be a digit.
• If the value in the first column is incorrect (the character is neither A nor B) then massage X will
be displayed.
• If the value in the second column is incorrect (the character is not a digit) then massage Y will be
displayed.
Causes are:
Now, we are going to make a Cause-Effect graph for the above situation:
• C1 - Character in column 1 is A
• C2 - Character in column 1 is B
• C3 - Character in column 2 is digit!
Effects:
• E1 - Update made (C1 OR C2) AND C3
• E2 - Displays Massage X (NOT C1 AND NOT C2)
• E3 - Displays Massage Y (NOT C3)
• Where AND, OR, NOT are the logical gates.
Steps to proceed on Cause-Effect Diagram:
• Firstly: Recognize and describe the input conditions (causes) and
actions (effect)
• Secondly: Build up a cause-effect graph
• Third: Convert the cause-effect graph into a decision table
• Fourth: Convert decision table rules to test cases. Each column of the
decision table represents a test case
Note:
If function gives output (effect) according to the input (cause) so, it is
considered as defect free, and if not doing so, then it is sent to the
development team for the correction
Structural Testing:
• Structural testing is the type of testing carried out to test the structure of code.
• It is also known as White Box testing or Glass Box testing.
• This type of testing requires knowledge of the code, so, it is mostly done by the
developers.
• It is more concerned with how system does it rather than the functionality of
the system.
• It helps in performing a thorough testing on software.
• The structural testing is mostly automated.
• It provides more coverage to the testing. For ex, to test certain error message in
an application, we need to test the trigger condition for it, but there must be
many trigger for it. It is possible to miss out one while testing the requirements
drafted in SRS. But using this testing, the trigger is most likely to be covered since
structural testing aims to cover all the nodes and paths in the structure of code.
Path Testing
• In path testing method, the control flow graph of a program is
designed to find linearly independent paths of execution.
• In this method Cyclomatic Complexity is used to determine the
number of linearly independent paths and then test cases are
generated for each path.
• It give complete branch coverage.Process for path testing.
STEP-1 : DRAW CONTROL FLOW GRAPH FOR
GIVEN CODE
• Consider the following code to compute GCD:
1. { int x , y;
2. while ( x!=y)
3. { if (x > y)
4. x = x – y;
5. else y= y- x;
6. }
7. return x; }
STEP-II : CALCULATION OF
CYCLOMATIC
COMPLEXITY
• Now Cyclomatic complexity can be computed as:
• PATH- I: 1,2,3,4,6,2,7
• Data flow testing is used to analyze the flow of data in the program.
• It is the process of collecting information about how the variables flow
the data in the program.
• Data flow testing is a group of testing strategies to examine the control
flow of programs in order to explore the sequence of variables
according to the sequence of events.
Let us take an Example:
Associations(link)
In this code, we have a total 8 statements, and we will choose a path which covers all the 8 statements. As it is evident
in the code, we cannot cover all the statements in a single path because if statement 2 is true then statements 4, 5, 6, 7
not covered, and if statement 4 is true then statement 2 and 3 are not covered. So, we are taking two paths to cover all
the statements.
1. x= 1 Path - 1, 2, 3, 8 Output = 2
Output = 2 2. Set x= -1 Path = 1, 2, 4, 5, 6, 5, 6, 5, 7, 8
So,
x=-1+1 x=0
And the process continues as per algorithm and finally the output will be 2.
ADVANTAGES OF STRUCTURAL
TESTING
• It is expensive.
TOOLS REQUIRED FOR STRUCTURAL
TESTING
Some of the test tools that are used for White box or Structural Testing are as follow:
• Cucumber
• Jbehave
• Junit
• Cfix
COMPARISON BETWEEN STRUCTURAL
&
FUNCTIONAL TESTING