Professional Documents
Culture Documents
Software testing is a process of identifying the correctness of software by considering its all
attributes (Reliability, Scalability, Portability, Re-usability, Usability) and evaluating the execution of
software components to find the software bugs or errors or defects.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Types of Software Testing
If we want to ensure that our software is bug-free or stable, we must perform the various types of
software testing because testing is the only method that makes our application bug-free.
The categorization of software testing is a part of diverse testing activities, such as test strategy,
test deliverables, a defined test objective, etc. And software testing is the execution of the software
to find defects.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
The software testing mainly divided into two parts, which are as follows:
● Manual Testing
● Automation Testing
In other words, we can say that it is a procedure of verification and validation. Manual testing is
used to verify the behavior of an application or software in contradiction of requirements
specification.
We do not require any precise knowledge of any testing tool to execute the manual test cases. We
can easily prepare the test document while performing manual testing on any application.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Automation Testing
The most significant part of Software testing is Automation testing. It uses specific tools to
automate manual design test cases without any human interference.
Automation testing is the best way to enhance the efficiency, productivity, and coverage of Software
testing.
It is used to re-run the test scenarios, which were executed manually, quickly, and repeatedly.
In other words, we can say that whenever we are testing an application by using some tools is known
as automation testing.
We will go for automation testing when various releases or several regression cycles goes on the
application or software. We cannot write the test script or perform the automation testing without
understanding the programming language.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Unit Testing
Unit testing involves the testing of each unit or an individual component of the software application.
It is the first level of functional testing. The aim behind unit testing is to validate unit components
with its performance.
A unit is a single testable part of a software system and tested during the development phase of the
application software.
The purpose of unit testing is to test the correctness of isolated code. A unit component is an
individual function or code of the application. White box testing approach used for unit testing and
usually done by the developers.
Whenever the application is ready and given to the Test engineer, he/she will start checking every
component of the module or module of the application independently or one by one, and this
process is known as Unit testing or components testing.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Example of Unit testing
Let us see one sample example for a better understanding of the concept of unit testing:
1. Amount transfer
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Below are the application access details, which is given by the customer
While performing unit testing, we should follow some rules, which are as follows:
● No over testing
● No assumption required
When we feel that the maximum test coverage is achieved, we will stop the testing.
Now, we will start performing the unit testing on the different components such as
● To account number(TAN)
● Amount
● Transfer
● Cancel
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
For the FAN components
Values Description
1234 accept
Copy and paste the value Error message→ type the value
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
For the TAN component
● Provide the values just like we did in From account number (FAN) components
● Provide the values just like we did in FAN and TAN components.
● NUnit
● JUnit
● PHPunit
● Parasoft Jtest
● EMMA
Unit testing uses all white box testing techniques as it uses the code of software application:
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
How to achieve the best result via Unit testing?
Unit testing can give best results without getting confused and increase complexity by following the
steps listed below:
● Naming conventions for unit test cases must be clear and consistent.
● During unit testing, the identified bugs must be fixed before jump on next phase of the SDLC.
● Adopt test cases with the writing of the code, if not doing so, the number of execution paths
will be increased.
● If there are changes in the code of any module, ensure the corresponding unit test is available
or not for that module.
● The developing team focuses on the provided functionality of the unit and how functionality
should look in unit test suits to understand the unit API.
● Unit testing allows the developer to refactor code after a number of days and ensure the
module is still working without any defect.
Disadvantages
● It cannot identify integration or broad level error as it works on units of the code.
● In the unit testing, evaluation of all execution paths is not possible, so unit testing is not able
to catch each and every error in a program.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Integration testing
Integration testing is the second level of the software testing process after unit testing. In this
testing, units or individual components of the software are tested in a group. The focus of the
integration testing level is to expose defects at the time of interaction between integrated
components or units.
Unit testing uses modules for testing purposes, and these modules are combined and tested in
integration testing. The Software is developed with a number of software modules that are coded by
different coders or programmers. The goal of integration testing is to check the correctness of
communication among all the modules.
Once all the components or modules are working independently, then we need to check the data flow
between the dependent modules is known as integration testing.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Let us see one sample example of a banking application, as we can see in the below image of
amount transfer.
● First, we will login as a user P to the amount transfer and send Rs200 amount, the
confirmation message should be displayed on the screen as amount transfer successfully.
Now logout as P and login as user Q and go to the amount balance page and check for a
balance in that account = Present balance + Received Balance. Therefore, the integration test
is successful.
● Also, we check if the amount of balance has reduced by Rs200 in P user account.
● Click on the transaction, in P and Q, the message should be displayed regarding the data and
time of the amount transfer.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Guidelines for Integration Testing
● We go for the integration testing only after the functional testing is completed on each
module of the application.
● First, determine the test case strategy through which executable test cases can be prepared
according to test data.
● Examine the structure and architecture of the application and identify the crucial modules to
test them first and also identify all possible scenarios.
● Choose input data for test case execution. Input data plays a significant role in testing.
● If we find any bugs then communicate the bug reports to developers and fix defects and
retest.
Here positive testing implies that if the total balance is Rs15, 000 and we are transferring Rs1500
and checking if the amount transfer works fine. If it does, then the test would be a pass.
And negative testing means, if the total balance is Rs15, 000 and we are transferring Rs20, 000 and
check if amount transfer occurs or not, if it does not occur, the test is a pass. If it happens, then there
is a bug in the code, and we will send it to the development team for fixing that bug.
Any application in this world will do functional testing compulsory, whereas integration testing will be
done only if the modules are dependent on each other. Each integration scenario should
compulsorily have source→ data→destination. Any scenario can be called an integration scenario
only if the data gets saved in the destination.
For example: In the Gmail application, the Source could be Compose, Data could be Email and the
Destination could be the Inbox.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Example of integration testing
Let us assume that we have a Gmail application where we perform the integration testing.
First, we will do functional testing on the login page, which includes the various components such
as username, password, submit, and cancel button. Then only we can perform integration testing.
Scenarios1:
● First, we login as P users and click on the Compose mail and perform the functional testing
for the specific components.
● Now we click on the Send and also check for Save Drafts.
● After that, we send a mail to Q and verify in the Send Items folder of P to check if the send
mail is there.
● Now, we will log out as P and login as Q and move to the Inbox and verify that if the mail has
reached.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Secanrios2: We also perform the integration testing on Spam folders. If the particular contact has
been marked as spam, then any mail sent by that user should go to the spam folder and not in the
inbox.
As we can see in the below image, we will perform the functional testing for all the text fields and
every feature. Then we will perform integration testing for the related functions. We first test the add
user, list of users, delete user, edit user, and then search user.
Note:
● There are some features, we might be performing only the functional testing, and there are
some features where we are performing both functional and integration testing based on the
feature's requirements.
● Prioritizing is essential, and we should perform it at all the phases, which means we will open
the application and select which feature needs to be tested first. Then go to that feature and
choose which component must be tested first. Go to those components and determine what
values to be entered first.
And don't apply the same rule everywhere because testing logic varies from feature to feature.
● While performing testing, we should test one feature entirely and then only proceed to another
function.
● Among the two features, we must be performing only positive integrating testing or both
positive and negative integration testing, and this also depends on the features need.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Reason Behind Integration Testing
Although all modules of software application already tested in unit testing, errors still exist due to the
following reasons:
1. Each module is designed by individual software developers whose programming logic may
differ from developers of other modules, so; integration testing becomes essential to
determine the working of software modules.
2. To check the interaction of software modules with the database whether it is erroneous or
not.
3. Requirements can be changed or enhanced at the time of module development. These new
requirements may not be tested at the level of unit testing hence integration testing becomes
mandatory.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Types of Integration Testing
Integration testing can be classified into two parts:
Incremental Approach
In the Incremental Approach, modules are added in ascending order one by one or according to
need. The selected modules must be logically related. Generally, two or more than two modules are
added and tested to determine the correctness of functions. The process continues until the
successful testing of all the modules.
OR
In this type of testing, there is a strong relationship between the dependent modules. Suppose we
take two or more modules and verify that the data flow between them is working fine. If it is, then
add more modules and test again.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
For example: Suppose we have a Flipkart application, we will perform incremental integration
testing, and the flow of the application would like this:
● Top-Down approach
● Bottom-Up approach
Top-Down ApproachThe top-down testing strategy deals with the process in which higher level
modules are tested with lower level modules until the successful completion of testing of all the
modules. Major design flaws can be detected and fixed early because critical modules are tested
first. In this type of method, we will add the modules incrementally or one by one and check the data
flow in the same order.
In the top-down approach, we will be ensuring that the module we are adding is the child of the
previous one like Child C is a child of Child B and so on as we can see in the below image:
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Advantages:
Disadvantages:
Bottom-Up Method
The bottom to up testing strategy deals with the process in which lower level modules are tested
with higher level modules until the successful completion of testing of all the modules. Top level
critical modules are tested at last, so it may cause a defect. Or we can say that we will be adding the
modules from bottom to the top and check the data flow in the same order.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
In the bottom-up method, we will ensure that the modules we are adding are the parent of the
previous one as we can see in the below image:
Advantages
Disadvantages
● Critical modules are tested last due to which the defects can occur.
● There is no possibility of an early prototype.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Hybrid Testing Method
In this approach, both Top-Down and Bottom-Up approaches are combined for testing. In this
process, top-level modules are tested with lower level modules and lower level modules tested with
high-level modules simultaneously. There is less possibility of occurrence of defects because each
module interface is tested.
Advantages
● The hybrid method provides features of both Bottom Up and Top Down methods.
● It is most time reducing method.
● It provides complete testing of all modules.
Disadvantages
● This method needs a higher level of concentration as the process carried out in both
directions simultaneously.
● Complicated method.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Non- incremental integration testing
We will go for this method, when the data flow is very complex and when it is difficult to find who is a
parent and who is a child. And in such a case, we will create the data in any module bang on all other
existing modules and check if the data is present. Hence, it is also known as the Big bang method.
In this approach, testing is done via integration of all modules at once. It is convenient for small
software systems, if used for large software systems identification of defects is difficult.
Since this testing can be done after completion of all modules due to that testing team has less time
for execution of this process so that internally linked interfaces and high-risk critical modules can be
missed easily.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Advantages:
● It is convenient for small size software systems.
Disadvantages:
● Identification of defects is difficult because finding the error where it came from is a problem,
and we don't know the source of the bug.
● Small modules missed easily.
● Time provided for testing is very less.
● We may miss to test some of the interfaces.
Let us see examples for our better understanding of the non-incremental integration testing or big
bang method:
Example1
In the below example, the development team develops the application and sends it to the CEO of the
testing team. Then the CEO will log in to the application and generate the username and password
and send a mail to the manager. After that, the CEO will tell them to start testing the application.
Then the manager manages the username and the password and produces a username and
password and sends it to the test leads. And the test leads will send it to the test engineers for
further testing purposes. This order from the CEO to the test engineer is top-down incremental
integrating testing.
In the same way, when the test engineers are done with testing, they send a report to the test leads,
who then submit a report to the manager, and the manager will send a report to the CEO. This
process is known as Bottom-up incremental integration testing as we can see in the below image:
Note: The combination incremental integration testing (I.I.T) and non-incremental integration testing
is known as sandwich testing.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
System Testing
System Testing includes testing of a fully integrated software system.
The software is developed in units and then interfaced with other software and hardware to create a
complete computer system. In other words, a computer system consists of a group of software to
perform the various tasks, but only software cannot perform the task; for that software must be
interfaced with compatible hardware.
System testing is a series of different types of tests with the purpose to exercise and examine the
full working of an integrated software computer system against requirements.
To check the end-to-end flow of an application or the software as a user is known as System testing.
In this, we navigate (go through) all the necessary modules of an application and check if the end
features or the end business works fine, and test the product as a whole system.
It is end-to-end testing where the testing environment is similar to the production environment.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Types of System Testing
System testing is divided into more than 50 types, but software testing companies typically uses
some of them. These are listed below:
Regression Testing
Regression testing is performed under system testing to confirm and identify if there's any defect in
the system due to modification in any other part of the system. It makes sure, any changes done
during the development process have not introduced a new defect and also gives assurance; old
defects will not exist on the addition of new software over the time.
Load Testing
Load testing is performed under system testing to clarify whether the system can work under
real-time loads or not.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Functional Testing
Functional testing of a system is performed to find if there's any missing function in the system.
Tester makes a list of vital functions that should be in the system and can be added during
functional testing and should improve the quality of the system.
Recovery Testing
Recovery testing of a system is performed under system testing to confirm reliability,
trustworthiness, accountability of the system and all are lying on recouping skills of the system. It
should be able to recover from all the possible system crashes successfully.
In this testing, we will test the application to check how well it recovers from the crashes or
disasters.
● Whenever the software crashes, it should not vanish but should write the crash log message
or the error log message where the reason for crash should be mentioned. For example:
C://Program Files/QTP/Cresh.log
● It should kill its own procedure before it vanishes. Like, in Windows, we have the Task
Manager to show which process is running.
● We will introduce the bug and crash the application, which means that someone will lead us to
how and when will the application crash. Or By experiences, after few months of involvement
on working the product, we can get to know how and when the application will crash.
● Re-open the application; the application must be reopened with earlier settings.
For example: Suppose, we are using the Google Chrome browser, if the power goes off, then we
switch on the system and re-open the Google chrome, we get a message asking whether we want to
start a new session or restore the previous session.
For any developed product, the developer writes a recovery program that describes why the software
or the application is crashing, whether the crash log messages are written or not, etc.
Migration Testing
Migration testing is performed to ensure that if the system needs to be modified in new
infrastructure so it should be modified without any issue.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Usability Testing
The purpose of this testing is to make sure that the system is well familiar with the user and it meets
its objective for what it is supposed to do.
This testing of the system intends to check hardware and software compatibility. The hardware
configuration must be compatible with the software to run it without any issue. Compatibility provides
flexibility by providing interactions between hardware and software.
● System Testing gives hundred percent assurance of system performance as it covers end to
end function of the system.
● System testing uses both existing system and a new system to feed the same data in both
and then compare the differences in functionalities of added and existing functions so the
user can understand benefits of new added functions of the system.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Verification and Validation Testing
Verification testing
Verification testing includes different activities such as business requirements, system requirements,
design review, and code walkthrough while developing a product.
It is also known as static testing, where we are ensuring that "we are developing the right product or
not". And it also checks that the developed application fulfills all the requirements given by the client.
Validation testing
Validation testing is testing where testers performed functional and non-functional testing. Here
functional testing includes Unit Testing(UT), Integration Testing(IT) and System Testing (ST), and
non-functional testing includes User acceptance testing (UAT).
Validation testing is also known as dynamic testing, where we are ensuring that "we have developed
the product right." And it also checks that the software meets the business needs of the client.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Validation testing can be best demonstrated using V-Model. The Software/product under test is
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Difference between verification and validation testing
Verification Validation
We check whether we are developing the right We check whether the developed product is right.
product or not.
Verification is also known as static testing. Validation is also known as dynamic testing.
Verification includes different methods like Validation includes testing like functional, system,
Inspections, Reviews, and Walkthroughs. integration and User acceptance testing.
It is a process of checking the work-products (not It is a process of checking the software during or at
the final product) of a development cycle to decide the end of the development cycle to decide whether
whether the product meets the specified the software follow the specified business
requirements. requirements.
Quality assurance comes under verification testing. Quality control comes under validation testing.
The execution of code does not happen in the In validation testing, the execution of code happens.
verification testing.
In verification testing, we can find the bugs early in In the validation testing, we can find those bugs,
the development phase of the product. which are not caught in the verification process.
Verification testing is executed by the Quality Validation testing is executed by the testing team to
assurance team to make sure that the product is test the application.
developed according to customers' requirements.
Verification is done before the validation testing. After verification testing, validation testing takes
place.
In this type of testing, we can verify that the inputs In this type of testing, we can validate that the user
follow the outputs or not. accepts the product or not.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
WHITE-BOX TESTING
White Box Testing is a testing technique in which software’s internal structure, design, and
coding are tested to verify input-output flow and improve design, usability, and security. In white box
testing, code is visible to testers, so it is also called Clear box testing, Open box testing, Transparent
box testing, Code-based testing, and Glass box testing.
Using white-box testing methods, you can derive test cases that
(1) guarantee that all independent paths within a module have been exercised at least once,
(2) exercise all logical decisions on their true and false sides,
(3) execute all loops at their boundaries and within their operational bounds, and
(4) exercise internal data structures to ensure their valid
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
1. Control Flow Graph –
A control flow graph (or simply, flow graph) is a directed graph which represents the control
structure of a program or module. A control flow graph (V, E) has V number of nodes/vertices
and E number of edges in it. A control graph can also have :
● Junction Node – a node with more than one arrow entering it.
● Decision Node – a node with more then one arrow leaving it.
● Region – area bounded by edges and nodes (area outside the graph is also
counted as a region.).
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Below are the notations used while constructing a flow graph :
● Sequential Statements –
● If – Then – Else –
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
● Do – While –
● While – Do –
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
● Switch – Case –
Here we will take a simple example, to get a better idea what is basis path testing include
In the above example, we can see there are few conditional statements that is executed depending on
what condition it suffice. Here there are 3 paths or 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
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Cyclomatic Complexity –
The cyclomatic complexity V(G) is said to be a measure of the logical complexity of a program. It
can be calculated using three different formulae :
Formula based on edges and nodes :
V(G) = e - n + 2*P
Where,
e is number of edges,
n is number of vertices,
P is number of connected components.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Independent Paths :
An independent path in the control flow graph is the one which introduces at least one
new edge that has not been traversed before the path is defined. The cyclomatic
complexity gives the number of independent paths present in a flow graph. This is because
the cyclomatic complexity is used as an upper-bound for the number of tests that should be
executed in order to make sure that all the statements in the program have been executed at
least once.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Example :
Consider the code snippet below, which is a simple program to add two numbers
together.
int a = 1;
int b = 2;
cout<<"a + b = "<<a+b;
Cyclomatic complexity
The cyclomatic complexity of the control flow graph will be calculated as:
Method 1
CC = E - N + 2P
CC = 2 - 3 + 2(1)
CC = 1
Method 2
CC = D + 1
CC = 0 + 1
CC = 1
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Consider the code snippet below, which is a program to get the maximum of two
numbers.
int a = 1;
int b = 2;
if (a>b){
cout<<"a is greater";
}else{
cout<<"b is greater";
}
The control flow graph of the code snippet above will be as follows:
Cyclomatic complexity
The cyclomatic complexity of the control flow graph will be calculated as:
Method 1
CC = E - N + 2P
CC = 6 - 6 + 2(1)
CC = 2
Method 2
CC = D + 1
CC = 1 + 1
CC = 2
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
int main (){
int n, index;
cout << "Enter a number: " << endl;
cin >> n;
index = 2;
while (index <= n - 1) {
if (n % index == 0) {
cout << "It is not a prime number" << endl;
break;
}
index++;
}
if (index == n)
cout << "It is a prime number" << endl;
} // end main
initialized in that statement). If a variable is initialized and declared on the same line, however, the
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Step 2 − Combine all of the sequential statements into one node. Statements 1, 2, and 3 are, for
example, all consecutive statements that should be concatenated into a single node. For the rest of
the statements, we'll use the notations described here.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Method 2:
V(G) = d + p
Method 3:
V(G) = Number of Regions (method 3)
There are four zones in the aforementioned control flow graph, as indicated below −
As a result, there are four distinct regions: R1, R2, R3, and R4.
It's worth noting that all three ways get the same cyclomatic complexity V value (G).
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Independent Paths
Because the cyclomatic complexity V(G) for the graph is 4, there are 4 independent paths.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
The following are the edges that Path 1 and Path 2 cover −
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
A - B - C - E - B - F - G - H is the third path
Only two edges remain uncovered, namely edge C-D and edge D-F. As a result, these two edges
Each of these pathways has at least one new edge that has never been crossed previously.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Test Cases
We must use the previously discovered independent paths to generate test cases. Provide input to
the program in such a way that each independent path is executed to create a test case.
The following test cases will be obtained for the supplied program −
1 1 No output A-B-F-H
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Control Structure Testing
Control structure testing is used to increase the coverage area by testing various control
structures present in the program. The different types of testing performed under control
structure testing are as follows-
1. Condition Testing
2. Data Flow Testing
3. Loop Testing
1. Condition Testing :
Condition testing is a test cased design method, which ensures that the logical condition and
decision statements are free from errors. The errors present in logical conditions can be
incorrect boolean operators, missing parentheses in a booleans expression, error in
relational operators, arithmetic expressions, and so on.
The common types of logical conditions that are tested using condition testing are-
1. A relation expression, like E1 op E2 where ‘E1’ and ‘E2’ are arithmetic expressions
and ‘OP’ is an operator.
2. A simple condition like any relational expression preceded by a NOT (~) operator.
For example, (~E1) where ‘E1’ is an arithmetic expression and ‘a’ denotes NOT
operator.
3. A compound condition consists of two or more simple conditions, Boolean operator,
and parenthesis.
For example, (E1 & E2)|(E2 & E3) where E1, E2, E3 denote arithmetic expression and
‘&’ and ‘|’ denote AND or OR operators.
4. A Boolean expression consists of operands and a Boolean operator like ‘AND’, OR,
NOT.
For example, ‘A|B’ is a Boolean expression where ‘A’ and ‘B’ denote operands and |
denotes OR operator.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
2. Data Flow Testing :
Data Flow Testing is a specific strategy of software testing that focuses on data
variables and their values. It makes use of the control flow graph. When it comes to
categorization Data flow testing will can be considered as a type of white box testing and
structural types of testing. It keeps a check at the data receiving points by the variables
and its usage points. It is done to cover the path testing and branch testing gap.
The process is conducted to detect the bugs because of the incorrect usage of data
variables or data values. For e.g. Initialization of data variables in programming code, etc.
● The programmer can perform numerous tests on data values and variables.
This type of testing is referred to as data flow testing.
● It is performed at two abstract levels: static data flow testing and dynamic data
flow testing.
● The static data flow testing process involves analyzing the source code without
executing it.
● Static data flow testing exposes possible defects known as data flow anomaly.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Let us understand this with the help of an example.
There are 8 statements in this code. In this code we cannot cover all 8 statements in a
single path as if 2 is valid then 4, 5, 6, 7 are not traversed, and if 4 is valid then statement
Hence we will consider two paths so that we can cover all the statements.
x= 1
Path – 1, 2, 3, 8
Output = 2
x>0 we will move to statement 3 (a= x+1) and at end, it will go to statement 8 and print x
=2.
Set x= -1
Path = 1, 2, 4, 5, 6, 5, 6, 5, 7, 8
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Output = 2
x is set as 1 then it goes to step 1 to assign x as 1 and then moves to step 2 which is
false as x is smaller than 0 (x>0 and here x=-1). It will then move to step 3 and then jump
to step 4; as 4 is true (x<=0 and their x is less than 0) it will jump on 5 (x<1) which is true
So,
x=-1+1
x=0
6 (x=x+1)
x=x+1
x= 0+1
x=1
x is now 1 and jump to step 5 (x<1) and now the condition is false and it will jump to step
7 (a=x+1) and set a=2 as x is 1. At the end the value of a is 2. And on step 8 we get the
output as 2.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
3. Loop Testing :
Loop testing is actually a white box testing technique. It specifically focuses on the validity of
loop construction.
Following are the types of loops.
1. Simple Loop – The following set of test can be applied to simple loops, where the
maximum allowable number through the loop is n.
1. Skip the entire loop.
2. Traverse the loop only once.
3. Traverse the loop two times.
4. Make p passes through the loop where p<n.
5. Traverse the loop n-1, n, n+1 times.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
2. Concatenated Loops – If loops are not dependent on each other, contact loops
can be tested using the approach used in simple loops. if the loops are
interdependent, the steps are followed in nested loops.
3. Nested Loops – Loops within loops are called as nested loops. when testing
nested loops, the number of tested increases as level nesting increases.
The following steps for testing nested loops are as follows-
1. Start with inner loop. set all other loops to minimum values.
2. Conduct simple loop testing on inner loop.
3. Work outwards.
4. Continue until all loops tested.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
4. Unstructured loops – This type of loops should be redesigned, whenever
possible, to reflect the use of unstructured the structured programming constructs.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Black Box Testing
● Black box testing is used during the later stages of testing after white
box testing has been performed.
● Graph Representation
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Equivalence Partitioning Method
○ Input set: {-2.5, 7.3, 8.4} Eq classes: {-2.5, 7.3, 8.4}, {any other x}
For Example:
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
As present in the above image, the “AGE” text field accepts only numbers from 18 to 60. There will be
three sets of classes or groups.
We have thus reduced the test cases to only 3 test cases based on the formed classes thereby covering
all the possibilities. So, testing with any one value from each set of the class is sufficient to test the above
scenario.
Assume that there is a function of a software application that accepts a particular number of digits,
not greater and less than that particular number. For example, an OTP number which contains only
six digits, less or more than six digits will not be accepted, and the application will redirect the user
to the error page.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Boundary Value Analysis Technique
The name itself defines that in this technique, we focus on the values at boundaries as it is found that
many applications have a high amount of issues on the boundaries.
Boundary refers to values near the limit where the behavior of the system changes. In boundary value
analysis, both valid and invalid inputs are being tested to verify the issues.
● It is for this reason that boundary value analysis (BVA) has been developed as
a testing technique
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
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.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
What is Test case?
A test case is a document, which has a set of test data, preconditions, expected results and
postconditions, developed for a particular test scenario in order to verify compliance against a
specific requirement.
Test Case acts as the starting point for the test execution, and after applying a set of input values,
the application has a definitive outcome and leaves the system at some end point or also known as
execution postcondition.
Example:
Let us say that we need to check an input field that can accept maximum of 10 characters.
While developing the test cases for the above scenario, the test cases are documented the
following way. In the below example, the first case is a pass scenario while the second case is a
FAIL.
Verify that the input field that Login to application Application should be Application accepts
can accept maximum of 10 and key in 10 able to accept all 10 all 10 characters.
characters characters characters.
Verify that the input field that Login to application Application should NOT Application accepts
can accept maximum of 11 and key in 11 accept all 11 characters. all 10 characters.
characters characters
If the expected result doesn't match with the actual result, then we log a defect. The defect goes
through the defect life cycle and the testers address the same after fix.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Software Maintenance
Software maintenance is a part of the Software Development Life Cycle. Its primary goal is to modify
and update software applications after delivery to correct errors and to improve performance.
Software is a model of the real world. When the real world changes, the software requires alteration
wherever possible.
Thus the maintenance is required to ensure that the system continues to satisfy user requirements.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
1. Corrective Maintenance
Corrective maintenance aims to correct any remaining errors regardless of where they may cause
specifications, design, coding, testing, and documentation, etc.
This includes modifications and updations done in order to correct or fix problems, which are either
discovered by user or concluded by user error reports.
2. Adaptive Maintenance
It contains modifying the software to match changes in the ever-changing environment.
This includes modifications and updations applied to keep the software product up-to date and
tuned to the ever changing world of technology and business environment.
3. Preventive Maintenance
This includes modifications and updates done in order to keep the software usable over long period
of time. It includes new features, new user requirements for refining the software and improve its
reliability and performance.
It is the process by which we prevent our system from being obsolete. It involves the concept of
reengineering & reverse engineering in which an old system with old technology is re-engineered
using new technology. This maintenance prevents the system from dying out.
4. Perfective Maintenance
It defines improving processing efficiency or performance or restricting the software to enhance
changeability. This may contain enhancement of existing system functionality, improvement in
computational efficiency, etc.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Cost of Maintenance
Reports suggest that the cost of maintenance is high. A study on estimating software maintenance
found that the cost of maintenance is as high as 67% of the cost of entire software process cycle.
On an average, the cost of software maintenance is more than 50% of all SDLC phases. There are
● Older softwares, which were meant to work on slow machines with less memory and
storage capacity cannot keep themselves challenging against newly coming enhanced
● Most maintenance engineers are newbie and use trial and error method to rectify
problem.
● Often, changes made can easily hurt the original structure of the software, making it
● Changes are often left undocumented which may cause more conflicts in future.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Software-end factors affecting Maintenance Cost
● Structure of Software Program
● Programming Language
Maintenance Activities
IEEE provides a framework for sequential maintenance process activities. It can be used in iterative
manner and can be extended so that customized items and processes can be included.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Software Re-engineering
When we need to update the software to keep it to the current market, without impacting its
Legacy software cannot keep tuning with the latest technology available in the market. As the
hardware becomes obsolete, updating software becomes a headache. Even if software grows old
For example, initially Unix was developed in assembly language. When language C came into
existence, Unix was re-engineered in C, because working in assembly language was difficult.
Other than this, sometimes programmers notice that few parts of software need more maintenance
Re-Engineering Process
● Decide what to re-engineer. Is it whole software or a part of it?
● Perform Reverse Engineering, in order to obtain specifications of existing software.
● Restructure Program if required. For example, changing function-oriented programs
into object-oriented programs.
● Re-structure data as required.
● Apply Forward engineering concepts in order to get re-engineered software.
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
There are few important terms used in Software re-engineering
Reverse Engineering
It is a process to achieve system specification by thoroughly analyzing, understanding the existing
system. This process can be seen as a reverse SDLC model, i.e. we try to get a higher abstraction
An existing system is a previously implemented design, about which we know nothing. Designers
then do reverse engineering by looking at the code and trying to get the design. With design in
hand, they try to conclude the specifications. Thus, going in reverse from code to system
specification.
Program Restructuring
It is a process to restructure and re-construct the existing software. It is all about re-arranging the
source code, either in the same programming language or from one programming language to a
different one. Restructuring can have either source code-restructuring and data-restructuring or
both.
Re-structuring does not impact the functionality of the software but enhances reliability and
maintainability. Program components, which cause errors very frequently can be changed, or
updated with restructuring.
The dependability of software on obsolete hardware platforms can be removed via restructuring.
Forward Engineering
Forward engineering is a process of obtaining desired software from the specifications in hand
which were brought down by means of reverse engineering. It assumes that there was some
Forward engineering is same as software engineering process with only one difference – it is carried
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel
Component reusability
A component is a part of software program code, which executes an independent task in the
—-----------------------------------------------------------------------------------------------------------------------------------------------
Software Engineering - Dr.A.K.Magore,Computer Engineering Department,GIT,Lavel