Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

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.

Equivalence partitioning or equivalence class partitioning (ECP)[1] is a software


testing technique that divides the input data of a software unit into partitions of equivalent data
from which test cases can be derived. In principle, test cases are designed to cover each
partition at least once.
Example-1: 
Let us consider an example of any college admission process. There is a college that gives
admissions to students based upon their percentage. 
Consider percentage field that will accept percentage only between 50 to 90 %, more and
even less than not be accepted, and application will redirect user to an error page. If
percentage entered by user is less than 50 %or more than 90 %, that equivalence
partitioning method will show an invalid percentage. If percentage entered is between 50 to
90 %, then equivalence partitioning method will show valid percentage. 
 

Advantages of Equivalence Partitioning


 Less number of tests
 Can cover all possible sets of tests data
 Less time in execution
 Minimizes sets of test data
Disadvantages of Equivalence Partitioning
 It does not consider the conditions for boundary value.
 The identification of equivalence classes relies heavily on the expertise of the testers 
Boundary Value Analysis

Boundary value analysis is one of the widely used case design technique for black box testing.
It is used to test boundary values because the input values near the boundary have higher
chances of error.

Boundary values are those that contain the upper and lower limit of a variable. Assume that,
age is a variable of any function, and its minimum value is 18 and the maximum value is 30,
both 18 and 30 will be considered as boundary values.

Testing of boundary values is done by making valid and invalid partitions. Invalid partitions
are tested because testing of output in adverse condition is also essential.
Let's understand via practical:

Imagine, there is a function that accepts a number between 18 to 30, where 18 is the
minimum and 30 is the maximum value of valid partition, the other values of this partition are
19, 20, 21, 22, 23, 24, 25, 26, 27, 28 and 29. The invalid partition consists of the numbers which
are less than 18 such as 12, 14, 15, 16 and 17, and more than 30 such as 31, 32, 34, 36 and 40.
Tester develops test cases for both valid and invalid partitions to capture the behavior of the
system on different input conditions.

The software system will be passed in the test if it accepts a valid number and gives the
desired output, if it is not, then it is unsuccessful. In another scenario, the software system
should not accept invalid numbers, and if the entered number is invalid, then it should display
error massage.

If the software which is under test, follows all the testing guidelines and specifications then it
is sent to the releasing team otherwise to the development team to fix the defects.

Advantages of Boundary Value Analysis

1. It is easier and faster to find defects using this technique. This is because the density of
defects at boundaries is more.
2. Instead of testing will all set of test data, we only pick the one at the boundaries. So,
the overall test execution time reduces.

Disadvantages of boundary value analysis

1. The success of the testing using this technique depends on the equivalence classes
identified, which further depends on the expertise of the tester and his knowledge of
the application. Hence, incorrect identification of equivalence classes leads to incorrect
boundary value testing.
2. Applications with open boundaries or applications not having one-dimensional
boundaries are not suitable for this technique. In those cases, other black-box
techniques like “Domain Analysis” are used.
Cause Effect Graph-
 

 Cause Effect Graph is a popular black box testing technique.


 It illustrates the relationship between a given outcome and all the factors that influence the
outcome graphically.
 
 

Here,

 A “Cause” stands for a distinct input condition that fetches about an internal change in the
system.
 An “Effect” represents an output condition, a system state that results from a combination
of causes.
 

Applications-
 

 For analyzing the existing problem so that corrective actions can be taken at the earliest.
 For relating the interactions of the system with the factors affecting a particular process.
 For identifying the possible root causes, reasons for a particular effect, problem or
outcome.
 

Advantages-
 

 It helps to determine the root causes of a problem or quality.


 It indicates possible causes of variation in a process.
 It identifies those areas where data should be collected for further study.
 It utilizes the team knowledge of the process by encouraging team participation.
 

Steps For Drawing Cause Effect Diagram-


 

The following steps are followed-

 Identify and describe the input conditions (causes) and actions (effect).
 Build up a cause-effect graph.
 Convert cause-effect graph into a decision table.
 Convert decision table rules to test cases where each column of the decision table
represents a test case.
Decision Table

A Decision Table is a table that shows the relationship between inputs and rules, cases, and
test conditions. It's a very useful tool for both complicated software testing and requirements
management. The decision table allows testers to examine all conceivable combinations of
requirements for testing and to immediately discover any circumstances that were
overlooked. True(T) and False(F) values are used to signify the criteria.

What is Decision Table Testing?

Decision table testing is a type of software testing that examines how a system responds to
various input combinations. This is a methodical methodology in which the various input
combinations and the accompanying system behavior (Output) are tabulated. That's why it's
also known as a Cause-Effect table because it captures both causes and effects for
improved test coverage.
Let's start with a simple example.
Example 1 − How to Create a Login Screen Decision Base Table
Let's make a login screen with a decision table. A login screen with E-mail and Password
Input boxes.
The condition is simple − The user will be routed to the homepage if they give the right
username and password. An error warning will appear if any of the inputs are incorrect.

Conditions Rule 1 Rule 2 Rule 3 Rule 4

Username (T/F) F T F T

Password (T/F) F F T T

Output (E/H) E E E H
Legend

T - Make sure your login and password are correct.


F - Incorrect login or password


E - An error message appears.


H - The home screen appears.

Interpretation

Case 1 − Both the username and password were incorrect. An error message is
displayed to the user.


Case 2 − The username and password were both right, however, the password was
incorrect. An error message is displayed to the user.


Case 3 − Although the username was incorrect, the password was accurate. An error
message is displayed to the user.


Case 4 − The user's username and password were both accurate, and the user went
to the homepage.

Structural testing is a type of software testing which uses the internal design of the
software for testing or in other words the software testing which is performed by the team
which knows the development phase of the software, is known as structural testing.
Structural testing is basically related to the internal design and implementation of the
software i.e. it involves the development team members in the testing team. It basically
tests different aspects of the software according to its types. Structural testing is just the
opposite of behavioral testing.
Types of Structural Testing:
There are 4 types of Structural Testing:
Control Flow Testing:
Control flow testing is a type of structural testing that uses the programs’s control flow as a
model. The entire code, design and structure of the software have to be known for this type
of testing. Often this type of testing is used by the developers to test their own code and
implementation. This method is used to test the logic of the code so that required result can
be obtained.
Data Flow Testing:
It uses the control flow graph to explore the unreasonable things that can happen to data.
The detection of data flow anomalies are based on the associations between values and
variables. Without being initialized usage of variables. Initialized variables are not used
once.
Slice Based Testing:
It was originally proposed by Weiser and Gallagher for the software maintenance. It is
useful for software debugging, software maintenance, program understanding and
quantification of functional cohesion. It divides the program into different slices and tests
that slice which can majorly affect the entire software.
Mutation Testing:
Mutation Testing is a type of Software Testing that is performed to design new software
tests and also evaluate the quality of already existing software tests. Mutation testing is
related to modification a program in small ways. It focuses to help the tester develop
effective tests or locate weaknesses in the test data used for the program.
Advantages of Structural Testing:
 It provides thorough testing of the software.
 It helps in finding out defects at an early stage.
 It helps in elimination of dead code.
 It is not time consuming as it is mostly automated.
Disadvantages of Structural Testing:
 It requires knowledge of the code to perform test.
 It requires training in the tool used for testing.
 Sometimes it is expensive.
Structural Testing Tools:
 JBehave
 Cucumber
 Junit
 Cfix
Advantages Of Decision Table Testing

1. Decision tables are one of the most effective and full-proof design testing techniques.
2. Testers can use decision table testing to test the results of several input combinations and software
states.
3. It gives the developers to state and analyzes complex business rules.
4. Decision table testing is the most preferred black box testing and requirements management.
5. A decision table is used for modelling complex business logic. They can first be converted to test cases
and test scenarios through decision table testing.
6. This technique provides comprehensive coverage of all test cases that can significantly reduce the re-
work on writing test cases and test scenarios.
7. Decision tables guarantee coverage of all possible combinations of condition values which are called
completeness property.
8. Decision tables can be used iteratively. The table results created in the first testing iteration can be used
for the next and so on.
9. Decision tables are easy to understand, and everyone can use and implement this design and testing
method, scenarios and test cases without prior experience.
10. Multiple conditions, scenarios and results can be viewed and analyzed on the same page by both
developers and testers.

Control Flow Software Testing


 Difficulty Level : Medium
 Last Updated : 05 Aug, 2019

· Read

· Discuss

Control flow testing is a type of software testing that uses program’s control flow as a model. Control
flow testing is a structural testing strategy. This testing technique comes under white box testing. For
the type of control flow testing, all the structure, design, code and implementation of the software
should be known to the testing team.

This type of testing method is often used by developers to test their own code and own implementation
as the design, code and the implementation is better known to the developers. This testing method is
implemented with the intention to test the logic of the code so that the user requirements can be
fulfilled. Its main application is to relate the small programs and segments of the larger programs.

Control Flow Testing Process:


Following are the steps involved into the process of control flow testing:
 Control Flow Graph Creation:
From the given source code a control flow graph is created either manually or by using the
software.
 Coverage Target:
A coverage target is defined over the control flow graph that includes nodes, edges, paths,
branches etc.
 Test Case Creation:
Test cases are created using control flow graphs to cover the defined coverage target.
 Test Case Execution:
After the creation of test cases over coverage target, further test cases are executed.
 Analysis:
Analyze the result and find out whether the program is error free or has some defects.

Control Flow Graph:


Control Flow Graph is a graphical representation of control flow or computation that is done during the
execution of the program. Control flow graphs are mostly used in static analysis as well as compiler
applications, as they can accurately represent the flow inside of a program unit. Control flow graph was
originally developed by Frances E. Allen.

Cyclomatic Complexity:
Cyclomatic Complexity is the quantitative measure of the number of linearly independent paths in it. It
is a software metric used to describe the complexity of a program. It is computed using the Control
Flow Graph of the program.

M = E - N + 2P

Advantages of Control flow testing:


 It detects almost half of the defects that are determined during the unit testing.
 It also determines almost one-third of the defects of the whole program.
 It can be performed manually or automated as the control flow graph that is used can be made by
hand or by using software also.

Disadvantages of Control flow testing:


 It is difficult to find missing paths if program and the model are done by same person.
 Unlikely to find spurious features.

Cyclomatic Complexity
 Difficulty Level : Easy
 Last Updated : 27 Jul, 2022

· Read

· Discuss

Cyclomatic complexity of a code section is the quantitative measure of the number of linearly
independent paths in it. It is a software metric used to indicate the complexity of a program. It is
computed using the Control Flow Graph of the program. The nodes in the graph indicate the smallest
group of commands of a program, and a directed edge in it connects the two nodes i.e. if second
command might immediately follow the first command. 

For example, if source code contains no control flow statement then its cyclomatic complexity will be 1
and source code contains a single path in it. Similarly, if the source code contains one if condition then
cyclomatic complexity will be 2 because there will be two paths one for true and the other for false. 

Mathematically, for a structured program, the directed graph inside control flow is the edge joining two
basic blocks of the program as control may pass from first to second. 
So, cyclomatic complexity M would be defined as, 

M = E – N + 2P 

where, 
E = the number of edges in the control flow graph 
N = the number of nodes in the control flow graph 
P = the number of connected components 
 

Steps that should be followed in calculating cyclomatic complexity and test cases design are: 
 
 Construction of graph with nodes and edges from code.
 Identification of independent paths.
 Cyclomatic Complexity Calculation
 Design of Test Cases

Let a section of code as such: 


 

A = 10

IF B > C THEN

A = B

ELSE

A = C

ENDIF

Print A

Print B

Print C

Control Flow Graph of above code

 
The cyclomatic complexity calculated for above code will be from control flow graph. The graph
shows seven shapes(nodes), seven lines(edges), hence cyclomatic complexity is 7-7+2 = 2. 

Use of Cyclomatic Complexity: 


 
 Determining the independent path executions thus proven to be very helpful for Developers and
Testers.
 It can make sure that every path have been tested at least once.
 Thus help to focus more on uncovered paths.
 Code coverage can be improved.
 Risk associated with program can be evaluated.
 These metrics being used earlier in the program helps in reducing the risks.

Advantages of Cyclomatic Complexity:.


 It can be used as a quality metric, gives relative complexity of various designs.
 It is able to compute faster than the Halstead’s metrics.
 It is used to measure the minimum effort and best areas of concentration for testing.
 It is able to guide the testing process.
 It is easy to apply.

Disadvantages of Cyclomatic Complexity:


 It is the measure of the programs’s control complexity and not the data complexity.
 In this, nested conditional structures are harder to understand than non-nested structures.
 In case of simple comparisons and decision structures, it may give a misleading figure.

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. It tries to obtain
particular information of each particular point in the process.
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. It mainly
focuses on the points at which values assigned to the variables and the point at which these
values are used by concentrating on both points, data flow can be tested.

Data flow testing uses the control flow graph to detect illogical things that can interrupt the
flow of data. Anomalies in the flow of data are detected at the time of associations between
values and variables due to:

o If the variables are used without initialization.


o If the initialized variables are not used at least once.

Advantages of Data Flow Testing:


Data Flow Testing is used to find the following issues-
 To find a variable that is used but never defined,
 To find a variable that is defined but never used,
 To find a variable that is defined multiple times before it is use,
 Deallocating a variable before it is used.
Disadvantages of Data Flow Testing
 Time consuming and costly process
 Requires knowledge of programming languages
Example:
1. read x, y;2. if(x>y)3. a = x+1
else4. a = y-15. print a;
Control flow graph of above example:

Define/use of variables of above example:

Variable Defined at node Used at node

x 1 2, 3

y 1 2, 4
Variable Defined at node Used at node

a 3, 4 5

You might also like