0% found this document useful (0 votes)
10 views40 pages

Software Verification Validation and Testing

The document discusses different types of functional testing techniques including equivalence partitioning, boundary value analysis, decision table testing, and cause-effect graphing. Equivalence partitioning divides input data into equivalent classes and boundary value analysis selects test values at partition boundaries. Decision tables represent logical relationships between inputs and outputs, while cause-effect graphs model causal relationships.

Uploaded by

piyushkalson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views40 pages

Software Verification Validation and Testing

The document discusses different types of functional testing techniques including equivalence partitioning, boundary value analysis, decision table testing, and cause-effect graphing. Equivalence partitioning divides input data into equivalent classes and boundary value analysis selects test values at partition boundaries. Decision tables represent logical relationships between inputs and outputs, while cause-effect graphs model causal relationships.

Uploaded by

piyushkalson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Functional Testing

• It is a type of software testing which is used to verify the functionality of


the software application, whether the function is working according to the
requirement specification.
• In functional testing, each function tested by giving the value, determining
the output, and verifying the actual output with the expected value.
• Functional testing performed as black-box testing which is presented to
confirm that the functionality of an application or system behaves as we are
expecting. It is done to verify the functionality of the application.
Cont!!
• Functional testing also called as black-box testing, because it focuses
on application specification rather than actual code. Tester has to test
only for correct output.But no need to check the actual coding.
• Even testers donot have any knowledge of coding.
Need of Functional Testing:
• We need an easy way or special techniques that can select test cases
intelligently from the pool of test-case, such that all test scenarios
are covered.
Equivalence Partitioning

• Equivalence Partitioning or Equivalence Class Partitioning is type


of black box testing technique which can be applied to all levels of
software testing like unit, integration, system, etc. In this technique,
input data units are divided into equivalent partitions that can be
used to derive test cases which reduces time required for testing
because of small number of test cases.
• It divides the input data of software into different equivalence data
classes.
• You can apply this technique, where there is a range in the input
field.
• Example 1: Equivalence and Boundary Value
• Let’s consider the behavior of Order Veg. Rolls Text Box Below
• Rolls values 1 to 10 is considered valid. A success message is shown.
• While value 11 to 99 are considered invalid for order and an error
message will appear, “Only 10 Rolls can be ordered”

Order Rolls Submit


• Here is the test condition
1.Any Number greater than 10 entered in the Order Rolls field(let say 11) is considered
invalid.
2.Any Number less than 1 that is 0 or below, then it is considered invalid.
3.Numbers 1 to 10 are considered valid
4.Any 3 Digit Number say -100 is invalid.
• We cannot test all the possible values because if done, the number of test cases will
be more than 100. To address this problem, we use equivalence partitioning
hypothesis where we divide the possible values of tickets into groups or sets as
shown below where the system behavior can be considered the same.
• The divided sets are called Equivalence Partitions or Equivalence Classes. Then
we pick only one value from each partition for testing. The hypothesis behind
this technique is that if one condition/value in a partition passes all others
will also pass. Likewise, if one condition in a partition fails, all other
conditions in that partition will fail.
What is Boundary Testing?

• Boundary testing is the process of testing between extreme ends or boundaries


between partitions of the input values.
• So these extreme ends like Start- End, Lower- Upper, Maximum-Minimum, Just Inside-
Just Outside values are called boundary values and the testing is called “boundary
testing”.
• The basic idea in normal boundary value testing is to select input variable values at
their:
1.Minimum
2.Just above the minimum
3.A nominal value
4.Just below the maximum
5.Maximum
• In our earlier equivalence partitioning example, instead of checking one value
for each partition, you will check the values at the partitions like 0, 1, 10, 11 and
so on. As you may observe, you test values at both valid and invalid
boundaries. Boundary Value Analysis is also called range checking.
• Equivalence partitioning and boundary value analysis(BVA) are closely related
and can be used together at all levels of testing.
Example 2:
• Following password field accepts minimum 6 characters and maximum 10 characters
• That means results for values in partitions 0-5, 6-10, 11-14 should be equivalent.

Test Scenario # Test Scenario Description Expected Outcome

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

• Let’s create a decision table for a 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

Error message Error message Error message


Error message Error message Error message
Error message size and format and for format, size,
Output Photo uploaded resolution for format for format and
size mismatch resolution resolution and resolution
mismatch mismatch size mismatch
mismatch mismatch mismatch
Why Decision Table Testing is Important?

• Decision Table Testing is Important because it helps to test


different combinations of conditions and provides better test
coverage for complex business logic.
• When testing the behavior of a large set of inputs where system
behavior differs with each set of inputs, decision table testing
provides good coverage and the representation is simple so it is easy
to interpret and use.
How it is different from BVA and ECP:
• In Software Engineering, boundary value and equivalent partition
are other similar techniques used to ensure better coverage.
• They are used if the system shows the same behavior for a large set
of inputs.
• However, in a system where for each set of input values the system
behavior is different, boundary value and equivalent partitioning
technique are not effective in ensuring good test coverage.
• In this case, decision table testing is a good option. This technique
can make sure of good coverage, and the representation is simple so
that it is easy to interpret and use.
• This table can be used as the reference for the requirement and for
functionality development since it is easy to understand and cover
Advantages of Decision Table Testing
• When the system behavior is different for different inputs and not the
same for a range of inputs, both equivalent partitioning, and boundary
value analysis won’t help, but a decision table can be used.
• The representation is simple so that it can be easily interpreted and is
used for development and business as well.
• This table will help to make effective combinations and can ensure better
coverage for testing
• Disadvantages of Decision Table Testing
The main disadvantage is that when the number of inputs increases the
table will become more complex.
Number of possible Combinations is given by 2 ^ n , where n is the number
of Inputs.
Cause and Effect Graph
• Cause-effect graph comes under the black box testing technique which
shows the relationship between a given result and all the factors
affecting the result.
• For example, while using email account, on entering valid email, the
system accepts it but, when you enter invalid email, it throws an error
message. In this technique, the input conditions are causes and the
result of these input conditions are effects.
Notations used in the Cause-Effect Graph
• AND - E1 is an effect and C1 and C2 are the causes. If both C1 and C2 are true, then effect E1
will be true.

• OR - If any cause from C1 and C2 is true, then effect E1 will be true .

NOT - If cause C1 is false, then effect E1 will be true.


Situation(Example):
The character in column 1 should be either A or B and in the column 2 should be a digit. If both
columns contain appropriate values then update is made. If the input of column 1 is incorrect, i.e.
neither A nor B, then message X will be displayed. If the input in column 2 is incorrect, i.e. input is
not a digit, then message Y will be displayed.

• 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:

1. V[G] = E-N+2 = 8-7+2 =3

2. V[G] = No. of predicate nodes + 1 =2+1=3

3. V[G] = No. of bounded regions + 1 =2+1=3

• Now, V[G] = No. of Linearly Independent Paths= No. of Test cases


STEP-III : COMPUTE LINEARLY INDEPENDENT PATHS

• PATH- I: 1,2,3,4,6,2,7

• PATH- II: 1,2,3,5,6,2,7

• PATH- III: 1,2,7


STEP-IV : DESIGN TEST CASES

• No. of test cases = No. of linearly independent paths

TEST CASE- I: 1,2,3,4,6,2,7 ( {x!=y}, {x>y} ) : x=7 , y=3

TEST CASE- II: 1,2,3,5,6,2,7 ( {x!=y}, {x<y} ) : x=2 , y=5

TEST CASE- III: 1,2,7 (x = y) : x=3 , y=3


Path Testing Techniques:
Control Flow Graph:
• The program is converted into control flow graph by representing the
code into nodes and edges.
Decision to Decision path:
• The control flow graph can be broken into various Decision to
Decision paths and then collapsed into individual nodes.
Independent paths:
• Independent path is a path through a Decision to Decision path graph
which cannot be reproduced from other paths by other methods.
CONTROL FLOW GRAPH
Control Flow Graph: It is a graphical representation of the program
depicting all the paths that may be transverse during the execution. It
contains:
• Basic Block or Node: It is a sequence of statements such that control
can only have one entry point and can exit the block only when all the
statements have been executed.
• Edge: It shows the control flow.
Decision-to-Decision (DD) path Graph
• A decision-to-decision path, or DD-path, is a path of execution
between two decisions.
• Every node on a flow graph of a program belongs to one DD-path.
• If the first node on a DD-path is traversed, then all other nodes on
that path will also be traversed.
Number of Independent Paths.
• On the basis of Nodes
Independent Paths = Edges - Nodes + 2 Independent Paths = 7 - 6 + 2
Independent Paths = 3
• On the basis of regions
Independent Paths = Regions + 1
Independent Paths = 2 + 1
Independent Paths =3
• On the basis of decisions
Independent Paths = Decisions + 1
Independent Paths = 2 + 1
Independent Paths = 3
Data Flow Testing

• 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

• Provides a more thorough testing of the software.

• Helps finding out defects at an early stage.

• Helps in eliminating dead code.

• Not time consuming as it is mostly automated.


DISADVANTAGES OF STRUCTURAL
TESTING

• Requires knowledge of the code.

• Requires training in the tool used for 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

You might also like