Unit-2 (Marks-18)
Types and Levels of Testing
Level of Testing
2.1 Unit Testing: Driver, Stub
Unit testing, a testing technique using which individual
modules are tested to determine if there are any issues by
the developer himself. It is concerned with functional
correctness of the standalone modules.
The main aim is to isolate each unit of the system to
identify, analyze and fix the defects.
Unit Testing - Advantages:
Reduces Defects in the newly developed features or
reduces bugs when changing the existing
functionality.
Reduces Cost of Testing as defects are captured in
very early phase.
Improves design and allows better refactoring of code.
Unit Tests, when integrated with build gives the
quality of the build as well.
Unit Testing Life Cycle:
STUBS:
Assume you have 3 modules, Module A, Module B and
module C. Module A is ready and we need to test it, but
module A calls functions from Module B and C which are
not ready, so developer will write a dummy module which
simulates B and C and returns values to module A. This
dummy module code is known as stub.
DRIVERS:
Now suppose you have modules B and C ready but module
A which calls functions from module B and C is not ready
so developer will write a dummy piece of code for module
A which will return values to module B and C. This dummy
piece of code is known as driver.
Difference between Stubs and Drivers
STUBS DRIVERS
Stubs used in Top Down Drivers used in Bottom Up
Integration Testing Integration Testing
Stubs are used when sub Drivers are used when main
programs are under programs are under
development development
Top most module is tested
Lowest module is tested first
first
It can simulate the behavior It can simulate the behavior
of lower level modules that of upper level modules that
are not integrated are not integrated
Drivers are the calling
Stubs are called programs
programs
2.2 Integration Testing: Top-Down Integration, Bottom-
Up Integration, Bi-Directional Integration.
Integration Testing:
Upon completion of unit testing, the units or modules are
to be integrated which gives raise to integration testing.
The purpose of integration testing is to verify the
functional, performance, and reliability between the
modules that are integrated.
Objectives of integration testing include:
To reduce risk
To verify whether the functional and non-functional
behaviors of the interfaces are as designed and
specified
To build confidence in the quality of the interfaces
To find defects (which may be in the interfaces
themselves or within the components or systems)
To prevent defects from escaping to higher test levels
Top-Down Integration:
In Top Down Integration Testing, testing takes place from
top to bottom. High-level modules are tested first and then
low-level modules and finally integrating the low-level
modules to a high level to ensure the system is working as
intended.
In this type of testing, Stubs are used as temporary module
if a module is not ready for integration testing.
Bottom-Up Integration:
It is a reciprocate of the Top-Down Approach. In Bottom Up
Integration Testing, testing takes place from bottom to up.
Lowest level modules are tested first and then high-level
modules and finally integrating the high-level modules to a
low level to ensure the system is working as
intended. Drivers are used as a temporary module for
integration testing.
Bi-Directional Integration:
Bi-Directional or Hybrid integration testing is also known
as Sandwich integration testing. It is the combination of
both Top-down and Bottom-up integration testing.
2.3 Testing and Web Application:
Performance Testing: Load Testing, Stress Testing,
Security Testing, Client Server Testing.
# Load Testing:
Load testing is performance testing technique using which
the response of the system is measured under various load
conditions. The load testing is performed for normal and
peak load conditions.
Load Testing Approach:
Evaluate performance acceptance criteria
Identify critical scenarios
Design workload Model
Identify the target load levels
Design the tests
Execute Tests
Analyze the Results
Objectives of Load Testing:
Response time
Throughput
Resource utilization
Maximum user load
Business-related metrics
#Stress Testing:
Stress testing a Non-Functional testing technique that is
performed as part of performance testing. During stress
testing, the system is monitored after subjecting the
system to overload to ensure that the system can sustain
the stress.
The recovery of the system from such phase (after stress)
is very critical as it is highly likely to happen in production
environment.
Reasons for conducting Stress Testing:
It allows the test team to monitor system performance
during failures.
To verify if the system has saved the data before
crashing or NOT.
To verify if the system prints meaning error messages
while crashing or did it print some random
exceptions.
To verify if unexpected failures do not cause security
issues.
Stress Testing - Scenarios:
Monitor the system behavior when maximum number of
users logged in at the same time.
All users performing the critical operations at the same
time.
All users Accessing the same file at the same time.
Hardware issues such as database server down or some of
the servers in a server park crashed.
#Security Testing:
Security testing is a testing technique to determine if an
information system protects data and maintains
functionality as intended. It also aims at verifying 6 basic
principles as listed below:
Confidentiality
Integrity
Authentication
Authorization
Availability
Non-repudiation
Security Testing - Techniques:
Injection
Broken Authentication and Session Management
Cross-Site Scripting (XSS)
Insecure Direct Object References
Security Misconfiguration
Sensitive Data Exposure
Missing Function Level Access Control
Cross-Site Request Forgery (CSRF)
Using Components with Known Vulnerabilities
Invalidated Redirects and Forwards
Open Source/Free Security Testing Tools:
Product Vendor URL
FxCop Microsoft https://www.owasp.org/index.ph
p/FxCop
FindBugs The http://findbugs.sourceforge.net/
University
of
Maryland
FlawFinder GPL http://www.dwheeler.com/flawfin
der/
Ramp GPL http://www.deque.com
Ascend
#Client Server Testing:
This type of testing usually done for 2 tier applications
(usually developed for LAN). Here we will be having Front-
end and Backend.
In Client Server we test features of applications like GUI on
both sides, functionality.
The tests performed on these types of applications would
be
1. User Interface Testing.
2. Functionality Testing.
3. Browser Compatibility Testing.
4. Load/Stress Testing.
5. Interoperability Testing/Intersystem Testing.
6. Storage and Data Volume Testing.
2.4 Acceptance Testing: Alpha Testing and Beta Testing,
Special Tests: Regression Testing, GUI Testing.
Acceptance testing, a testing technique performed to
determine whether or not the software system has met the
requirement specifications. The main purpose of
this test is to evaluate the system's compliance with the
business requirements and verify if it is has met the
required criteria for delivery to end users.
Types of Acceptance Testing:
#Alpha Testing:
Alpha testing takes place at the developer's site by the
internal teams, before release to external customers. This
testing is performed without the involvement of the
development teams.
Alpha Testing - In SDLC
The following diagram explains the fitment of Alpha testing
in the software development life cycle.
How do we run it?
In the first phase of alpha testing, the software is tested by
in-house developers during which the goal is to catch bugs
quickly.
In the second phase of alpha testing, the software is given
to the software QA team for additional testing.
Alpha testing is often performed for Commercial off-the-
shelf software (COTS) as a form of internal acceptance
testing, before the beta testing is performed.
#Beta Testing:
Beta testing also known as user testing takes place at the
end users site by the end users to validate the usability,
functionality, compatibility, and reliability testing.
Beta testing adds value to the software development life
cycle as it allows the "real" customer an opportunity to
provide inputs into the design, functionality, and usability
of a product. These inputs are not only critical to the
success of the product but also an investment into future
products when the gathered data is managed effectively.
Beta Testing - In SDLC
The following diagram explains the fitment of Beta testing
in the software development life cycle:
Beta Testing Dependencies
There are number of factors that depend on the success of
beta testing:
Test Cost
Number of Test Participants
Shipping
Duration of Test
Demographic coverage
#Regression Testing:
Regression testing a black box testing technique that
consists of re-executing those tests that are impacted by
the code changes. These tests should be executed as often
as possible throughout the software development life cycle.
Types of Regression Tests:
Final Regression Tests: - A "final regression testing"
is performed to validate the build that hasn't changed
for a period of time. This build is deployed or shipped
to customers.
Regression Tests: - A normal regression testing is
performed to verify if the build has NOT broken any
other parts of the application by the recent code
changes for defect fixing or for enhancement.
Selecting Regression Tests:
Requires knowledge about the system and how it
affects by the existing functionalities.
Tests are selected based on the area of frequent
defects.
Tests are selected to include the area, which has
undergone code changes many a times.
Tests are selected based on the criticality of the
features.
Regression Testing Steps:
Regression tests are the ideal cases of automation which
results in better Return On Investment (ROI).
Select the Tests for Regression.
Choose the apt tool and automate the Regression
Tests
Verify applications with Checkpoints
Manage Regression Tests/update when required
Schedule the tests
Integrate with the builds
Analyze the results
#GUI Testing:
GUI testing is a testing technique in which the
application's user interface is tested whether the
application performs as expected with respect to user
interface behavior.
GUI Testing includes the application behavior towards
keyboard and mouse movements and how different
GUI objects such as toolbars, buttons, menubars,
dialog boxes, edit fields, lists, behavior to the user
input.
GUI Testing Guidelines
Check Screen Validations
Verify All Navigations
Check usability Conditions
Verify Data Integrity
Verify the object states
Verify the date Field and Numeric Field Formats
GUI Automation Tools
Following are some of the open source GUI automation
tools in the market:
Licensed
Product URL
Under
AutoHotkey GPL http://www.autohotkey.com/
Selenium Apache http://docs.seleniumhq.org/
Sikuli MIT http://sikuli.org
Robot
Apache www.robotframework.org
Framework
watir BSD http://www.watir.com/
Dojo Toolkit BSD http://dojotoolkit.org/