Digital Notes: (Department of Computer Applications)
Digital Notes: (Department of Computer Applications)
Digital Notes
[Department of Computer Applications]
Subject Name : Software Engineering
Subject Code : KCA-203
Course : MCA
Branch : MCA
Semester : III
Prepared by : Mr. Yogendra Singh
Page 1 of 14
UN IT IV: Software Testing
Verification is the process of determining whether the output of one phase of software
development conforms to that of its previous phase, whereas validation is the process of
determining whether a fully developed system conforms to its requirements specification.
Thus while verification is concerned with phase containment of errors, the aim of validation
is that the final product be error free.
1. Unit Testing
2. Integration Testing
3. System Testing
Page 2 of 14
1. Unit Testing:
Unit testing is undertaken after a module has been coded and successfully reviewed.
Unit testing (or module testing) is the testing of different modules of a system in
isolation.
Unit testing is performed by the developers before the setup is handed over to the testing
team to formally execute the test cases.
The goal of unit testing is to isolate each part of the program and show that individual
Advantages:
Errors can be detected at early stages, saving time and money to fix it.
Limitations: Integration issues are not detected in this stage; modules may work perfectly on
Isolation but can have issues in interfacing between the modules.
2. Integration Testing:
Integration testing is performed immediately after the unit testing. In this all modules are
combined of an application to determine if they function correctly together is Integration
testing.
The primary objective of integration testing is to test the module interfaces, i.e. there are
no errors in the parameter passing, when one module invokes another module. During
integration testing, different modules of a system are integrated in a planned manner
using an integration plan
Page 3 of 14
1. Top-down Integration testing.
2. Bottom-up Integration testing
3. Big-Bang Integrtion Testing
4. Sandwich Testing
In this type of testing the modules at the leaf level are first tested and then we move up in the
hierarchy.
Drivers are used in this type of testing at different levels of hierarchy. Driver is a program
which accepts the test case data to be inputted and printed by the module to be tested.
.
Fig: Bottom up Approach
1. DRIVERS:
Drivers are used in bottom up testing approach. Drivers are dummy codes, which are
used when the sub-modules are ready but the main module is still not ready.
Page 4 of 14
All dummy program which are used to call the function of the lowest module in case
when the calling function doesn’t exist.
Fig: DEIVERS
2. STUBs:
Stubs are used in top-down testing approach. STUBs are dummy code, which are used when you
have the major module ready to test but the sub module are still not ready yet.
Fig: STUBs
Page 5 of 14
Difference between Stubs and Drivers:
Stubs Drivers
Used in Top-down approach Used in Bottom-up approach
Top most module is tested first Lowest module is tested first
Simulate the lower level of component Simulate the higher level of component
Dummy program of lower level Dummy program for higher level
component component
3. Big-Bang Integration Testing: In this all the modules after unit testing are combined
and tested in one go. The problem with this kind of testing is debugging of errors.
Page 6 of 14
System Testing:
System tests are designed to validate a fully developed system to assure that it meets its
requirements. System testing is a black-box testing
1. Alpha Testing.
Alpha testing refers to the system testing carried out by the test team within
The focus of this testing is to simulate real users by black box and white box
techniques.
2. Beta testing.
Beta testing is the system testing performed by a select group of friendly
customers.
Beta testing helps us to test the application in real time environment.
Regression Testing
Whenever a software product is updated with new code, feature or functionality, it is tested
thoroughly to detect if there is any negative impact of the added code. This is known as
regression testing.
Page 7 of 14
Functional testing vs. Structural testing
In the black-box testing approach, test cases are designed using only the functional specification
of the software, i.e. without any knowledge of the internal structure of the software. For this
reason, black-box testing is known as functional testing.
On the other hand, in the white-box testing approach, designing test cases requires thorough
knowledge about the internal structure of software, and therefore the white-box testing is called
structural testing.\
Testing Techniques:
Page 8 of 14
Black-box testing techniques:
The following are the three main approaches to designing black box test cases.
In this approach, the domain of input values to a program is partitioned into a set of
equivalence classes. This partitioning is done such that the behavior of the program is similar
for every input data belonging to the same equivalence class.
Example: For a software that computes the square root of an input integer which can assume
values in the range of 0 to 5000, there are three equivalence classes: The set of negative
integers, the set of integers in the range of 0 and 5000, and the integers larger than 5000.
Therefore, the test cases must include representatives for each of the three equivalence
classes and a possible test set can be: {-5, 500, 6000}.
Page 9 of 14
2. Boundary Value Analysis (BVA):
Boundary Value Analysis (BVA) is a Black-Box testing technique are helpful for detecting any
errors or threats at the boundary of an input domain
Example: For a function that computes the square root of integer values in the range of 0 and
5000, the test cases must include the following values: {0, -1, 5000, 5001}.
Page 10 of 14
In this testing method, the design and structure of the code are known to the tester. Programmers
of the code conduct this test on the code.
The statement coverage strategy aims to design test cases so that every statement in a program is
executed at least once. The principal idea governing the statement coverage strategy is that
unless a statement is executed, it is very hard to determine if an error exists in that statement.
Unless a statement is executed, it is very difficult to observe whether it causes failure due to
some illegal memory access, wrong result computation, etc. However, executing some statement
once and observing that it behaves properly for that input value is no guarantee that it will
behave correctly for all input values. In the following, designing of test cases using the statement
coverage strategy have been shown.
Page 11 of 14
2. Branch Coverage:
In the branch coverage-based testing strategy, test cases are designed to make each branch
condition to assume true and false values in turn. Branch testing is also known as edge testing as
in this testing scheme, each edge of a program’s control flow graph is traversed at least once.
It is obvious that branch testing guarantees statement coverage and thus is a stronger testing
strategy compared to the statement coverage-based testing. For Euclid’s GCD computation
algorithm , the test cases for branch coverage can be {(x=3, y=3), (x=3, y=2), (x=4, y=3), (x=3,
y=4)}.
3. Path coverage:
The path coverage-based testing strategy requires us to design test cases such that all linearly
independent paths in the program are executed at least once. A linearly independent path can be
defined in terms of the control flow graph (CFG) of a program.
Page 12 of 14
Code review:
Code review for a model is carried out after the module is successfully compiled and the all the
syntax errors have been eliminated. Code reviews are extremely cost-effective strategies for
reduction in coding errors and to produce high quality code.
Normally, two types of reviews are carried out on the code of a module. These two types code
review techniques are:
1. Code inspection and
2. Code walkthrough
Code Walkthrough:
Code walkthrough is an informal code analysis technique. In this technique, after a
module has been coded, compiled successfully, and all syntax errors eliminated.
It used to discover the algorithm and logical errors in the code.
Code Inspection
In contrast to code walk through, the aim of code inspection is to discover some common types
of errors caused due to oversight and improper programming.
Following is a list of some classical programming errors which can be checked during code
inspection:
• Use of uninitialized variables.
• Jumps into loops.
• Non-terminating loops.
• Incompatible assignments.
• Array indices out of bounds.
• Improper storage allocation and de-allocation.
Page 13 of 14
Page 14 of 14