software testing unit 2
software testing unit 2
Levels of testing
There are mainly four testing levels are:
1. Unit Testing : testing the individual units/component of a software/system is tested.
Purpose : to validate that each unit of software performs as designed
2. Integration Testing- individual units are combined and tested as a group.
Purpose : to expose faults in the interaction between integrated units.
3. System Testing-complete integrated system / software is tested
Purpose : to evaluate the system’s compliance with the specified requirements.
al
4. Acceptance Testing-test the final system for acceptability
Purpose : to evaluate the system’s compliance with the business requirements and
im
access whether it is acceptable for delivery
UNIT TESTING
Ka
What is Unit Testing?
With the help of neat diagram, describe unit testing.
Unit Testing : Software product is made up of many units , each unit needed to be tested
to find whether they have implemented the design correctly or not.
a
• UNIT Testing is defined as a type of software testing where individual units/
em
1
UNIT-II TYPES AND LEVELS OF TESTING
al
Explanation
im
Module interface - information properly flows into and out of the program unit
under test.
Ka
Local data structure - data stored temporarily maintains its integrity.
Boundary conditions - module operates properly at boundaries established to
limit or restrict processing.
a
Independent paths - all statements in a module have been executed at least
em
once.
And finally, all error handling paths are tested.
from another module or the module is calling some another module . Some interface modules
has to be simulated if required like drivers and stubs.
2
UNIT-II TYPES AND LEVELS OF TESTING
al
im
a Ka
em
3
UNIT-II TYPES AND LEVELS OF TESTING
However, they do not have to be thrown away: Stubs can be "filled in" to form the
actual method.
Drivers can become automated test cases.
Drivers
Drivers: The module where the required inputs for the module under test are simulated for
the purpose of module or unit testing is known as a Driver module. The driver module may
print or interpret the result produced by the module under test.
al
STUBS
im
Stubs: The module under testing may also call some other module which is not ready at the
time of testing. There is need of dummy modules required to simulate for testing, instead of
actual modules. These are called stubs.
Ka
Describe how drivers and stubs can be used in unit testing with neat diagrams. (Model
Answer)
1. Drivers
a
1. Drivers are tools used to control and operate the software being tested.
2. One of the simplest examples of a driver is a batch file, a simple list of programs or
em
commands that are executed sequentially. In the days of MS-DOS, this was a popular
means for testers to execute their test programs.
3. They‘d create a batch file containing the names of their test programs, start the
Se
4
UNIT-II TYPES AND LEVELS OF TESTING
al
2. Stubs
1. Stubs, like drivers, are white-box testing techniques.
im
2. Stubs are essentially the opposite of drivers in that they don‘t control or operate the
software being tested; they instead receive or respond to data that the software.
3. The Figure shows the general view of stub configuration.
a Ka
em
Stubs Drivers
1. Used in Top-Down Integration
Se
5
UNIT-II TYPES AND LEVELS OF TESTING
al
tests which can run in parallel.
JMockit: JMockit is open source Unit testing tool. It is a code coverage tool with line
im
and path metrics. It allows mocking API with recording and verification syntax. This
tool offers Line coverage, Path Coverage, and Data Coverage.
EMMA: EMMA is an open-source toolkit for analyzing and reporting code written in
Java language. Emma support coverage types like method, line, basic block. It is
Ka
Java-based so it is without external library dependencies and can access the source
code.
PHPUnit: PHPUnit is a unit testing tool for PHP programmer. It takes small portions
a
of code which is called units and test each of them separately.
Advantages of Unit Testing
em
Makes the Process Agile. One of the main benefits of unit testing is that it makes the
coding process more Agile. ...
Quality of Code. Unit testing improves the quality of the code. ...
Se
6
UNIT-II TYPES AND LEVELS OF TESTING
Integration testing
The purpose of integration testing is to verify the functional, performance, and
al
reliability between the modules that are integrated.
Top down approach
im
• In Top to down approach, testing takes place from top to down following the control
flow of the software system.
• Takes help of stubs for testing.
Ka
• In Top-down integration Modules are integrated by moving down through the control
hierarchy, beginning with the main control module .
• Other modules that are subordinate to the main control module are incorporated into
the structure in either a depth-first or breadth-first manner.
a
• Depth-first integration would integrate all components on a major control path of the
em
structure.
• Breadth-first integration incorporates all components directly subordinate at each
level, moving across the structure horizontally.
Se
7
UNIT-II TYPES AND LEVELS OF TESTING
Depth-first integration
Step :
One major control path may be integration of Components M1- M2 – M5-M8 or M1-
M2-M5-M6
Breadth-first integration
Step :
al
components M2-M3-M4 would be integrated first next control level would be, M5-
M6-M7
Top-down advantages
– Separately debugged modules.
im
– System test by integrating previously debugged modules.
Ka
– Stubs are easier to code than drivers.
– User interfaces are top-level modules.
a
Top-down disadvantages
– Logistical problems can raise.
em
Bottom – up Integration
In the bottom-up strategy, each module at lower levels is tested with higher modules
until all modules are tested.
It takes the help of Drivers for testing.
8
UNIT-II TYPES AND LEVELS OF TESTING
al
im
Components are combined to form clusters 1, 2, and 3. Each of the clusters is tested
using a driver.
Ka
Components in clusters 1 and 2 are subordinate to Ma.
Drivers D1 and D2 are removed and the clusters are interfaced directly to Ma.
Similarly, driver D3 for cluster 3 is removed prior to integration with module Mb.
Both Ma and Mb will ultimately be integrated with component Mc, and so forth.
a
em
Bottom-up advantages
1) Separately debugged modules.
2) System test by integrating previously debugged modules.
3) Testing upper-level modules is easier.
Se
Bidirectional/Sandwich/hybrid testing
In the sandwich/hybrid strategy is a combination of Top Down and Bottom up
approaches. Here, top modules are tested with lower modules at the same time lower
modules are integrated with top modules and tested.
This strategy makes use of stubs as well as drivers.
Testing Approach
al
A middle layer is identified from which bottom-up and top-down testing are done.
This middle layer is also known as target layer
im
a Ka
em
• Top-down testing starts from middle layer and moves downwards towards lower level
modules. This layer below middle layer is known as Bottom layer
• Bottom-up testing also starts from middle layer and move up towards top layer
modules. This layer above middle layer is known as Top layer
• With use of stubs and drivers, user interface and functions of lower level modules are
tested respectively
• In the end, only middle layer is left for the execution of the final test
Explain following concepts related to Integration testing with neat & labeled diagram:
10
UNIT-II TYPES AND LEVELS OF TESTING
al
1. Top-down Testing:
In this approach testing is conducted from main module to sub module. If the sub
im
module is not developed a temporary program called STUB is used for simulate the sub
module.
Advantages:
Advantageous if major flaws occur toward the top of the program.
Ka
Once the I/O functions are added, representation of test cases is easier.
Early skeletal Program allows demonstrations and boosts morale.
a
Disadvantages:
em
2. Bottom-up testing:
• In this approach testing is conducted from sub module to main module, if the main
module is not developed a temporary program called DRIVERS is used to simulate
the main module.
11
UNIT-II TYPES AND LEVELS OF TESTING
Advantages:
• · Test conditions are easier to create.
• · Observation of test results is easier.
• · Driver Modules must be produced.
• · The program as an entity does not exist until the last module is added.
Disadvantages
• When large number of subsystems exists at the same level then following bottom-up
approach turns out to be very complex. In extreme level it becomes quite similar to
al
big-bang approach.
• Driver Modules must be produced.
•
im
The program as an entity does not exist until the last module is added.
4. Using stubs, it tests the user interface in isolation as well as tests the very lowest level
functions using drivers.
5. Bi-directional Integration testing combines bottom-up and top-down testing.
6. Bottom-up testing is a process where lower level modules are integrated and then tested.
7. This process is repeated until the component of the top of the hierarchy is analyzed. It
helps custom software development services find bugs easily without any problems.
8. Top down testing is a process where the top integrated modules are tested and the
procedure is continued till the end of the related module.
9. Top down testing helps developers find the missing branch link easily.
12
UNIT-II TYPES AND LEVELS OF TESTING
al
Advantages:
1. This approach is useful for very large projects.
im
2. Both top down and bottom up approach starts at the start of the schedule.
3. It needs more resources and big teams for performing both, methods of testing at a time or
one after the other.
Ka
Disadvantages:
1. It represents very high cost of testing as lot of testing is done.
2. It cannot be used for smaller systems with huge interdependence between different
a
modules.
3. Different skill tests are required for testers at different level as modules are separate
em
SYSTEM TESTING
Q) Write a short note on :
Se
13
UNIT-II TYPES AND LEVELS OF TESTING
as printer, or communication ports, connect as many as you can. If you are testing an
internet server that can handle thousands of simultaneous connections, do it.
al
modems and so on. Look at your software and determine what external resources and
dependencies it has. Stress testing is simply limiting them to bare minimum. With
im
stress testing you starve the software.
For e.g. Word processor software running on your computer with all available
memory and disk space, it works fine. But if the system runs low on resources you
had a greater potential to expect a bug. Setting the values to zero or near zero will
Ka
make the software execute different path as it attempt to handle the tight constraint.
Ideally the software would run without crashing or losing data.
a
Stress testing and load testing can be best applied with the help of automation tools.
Stress testing and load testing are the types of performance testing. The Microsoft
em
stress utility program allows you to individually set the amounts of memory, disk space,
files and other resources available to the software running on the machine.
iii) Recovery testing: Recovery testing is a type of non-functional testing. Recovery testing
Se
is done in order to check how fast and better the application can recover after it has gone
through any type of crash or hardware failure etc.
• Recovery testing is the forced failure of the software in a variety of ways to verify that
recovery is properly performed.
• Determining the feasibility of the recovery process.
• Verification of the backup facilities.
• Ensuring proper steps are documented to verify the compatibility of backup facilities.
• Providing Training within the team.
• Demonstrating the ability of the organization to recover from all critical failures.
14
UNIT-II TYPES AND LEVELS OF TESTING
al
• · Assessment of a user's attitude towards using the software.
• · Usability testing, a non-functional testing technique that is a measure of how easily
im
the system can be used by end users.
• · It is difficult to evaluate and measure but can be evaluated based on the below
parameters:
Q) How to perform security testing? State elements of security testing.
Ka
Security Testing:
• Testers must use a risk-based approach, By identifying risks and potential loss
associated with those risks in the system and creating tests driven by those risks, the
a
testers can properly focus on areas of code in which an attack is likely to succeed.
Therefore risk analysis at the design level can help to identify potential security
em
15
UNIT-II TYPES AND LEVELS OF TESTING
al
3. Authentication ; This might involve confirming the identity of a person
4. Availability : Assuring that information and communications services are
available to authorized persons when they need it.
im
5. Authorization : The process of determining that a requester is allowed to
receive a service or perform an operation.
Access control is an example of authorization.
Ka
6. Non-repudiation : Non-repudiation means to ensure that a transferred message
has been sent and received by the parties claiming to have sent and received the
message. Non-repudiation is a way to guarantee that the sender of a message
cannot later deny having sent the message and that the recipient cannot deny
a
having received the message.
em
Acceptance testing
What is Functional Testing?
Functional testing is a type of testing which verifies that each function of the
software application operates in conformance with the requirement specification.
Se
This testing mainly involves black box testing, and it is not concerned about the
source code of the application.
Every functionality of the system is tested by providing appropriate input, verifying
the output and comparing the actual results with the expected results.
This testing involves checking of User Interface, APIs, Database, security, client/
server applications and functionality of the Application Under Test. The testing can
be done either manually or using automation
16
UNIT-II TYPES AND LEVELS OF TESTING
Non-functional testing
Non-functional testing is a type of testing to check non-functional aspects
(performance, usability, reliability, etc.) of a software application.
It is explicitly designed to test the readiness of a system as per nonfunctional
parameters which are never addressed by functional testing.
A good example of non-functional test would be to check how many people can
simultaneously login into a software.
Non-functional testing is equally important as functional testing and affects client
al
satisfaction.
im
Parameters Functional Non-functional testing
Requirements Functional testing is carried out This kind of testing is carried out by
using the functional performance specifications
specification.
Functionality It describes what the product It describes how the product works.
does.
17
UNIT-II TYPES AND LEVELS OF TESTING
al
• Regression testing • Load Testing
• Localization • Stress Testing
im
• Globalization • Compliance Testing
• Interoperability • Portability Testing
• Disaster Recover Testing
Ka
What is Acceptance Criteria?
Acceptance Criteria are conditions which a software application should satisfy to be
a
accepted by a user or customer.
em
for both functional and non-functional requirements of the project at the current stage.
These functional and non-functional requirements are the conditions which can be
acceptance.
There is no partial acceptance in acceptance criteria, it is is either passed or failed.
In Agile, it defines the boundaries of a user story and thus it is used to see whether the
user story is complete and working as it should be.
It is also known as test completion criteria and fit criteria. It should be mentioned in a
very simple language like a user story which a customer can understand.
It should have the expected result or the outcome written clearly without any
ambiguity.
18
UNIT-II TYPES AND LEVELS OF TESTING
al
3. Enter the name to be searched.
4. Hit Search button.
im
5. Expected results should be displayed
Comparison between alpha and beta testing.
3. Alpha Testing is not open to the market and 3. Beta Testing is always open to the market
public and public.
4. It is conducted for the software application 4. It is usually conducted for software product.
Se
and project.
8. Alpha Testing is definitely performed and 8. Beta Testing (field testing) is performed and
19
UNIT-II TYPES AND LEVELS OF TESTING
carried out at the developing organizations carried out by users or you can say people at
location with the involvement of developers. their own locations and site using customer
data.
9. It comes under the category of both White 9. It is only a kind of Black Box Testing.
Box Testing and Black Box Testing.
10. Alpha Testing is always performed at the 10. Beta Testing is always performed at the
time of Acceptance Testing when developers time when software product and project are
al
test the product and project to check whether it marketed.
meets the user requirements or not.
im
11. It is always performed at the developer‘s 11. It is always performed at the user‘s
premises in the absence of the users. premises in the absence of the development
team.
Ka
12. Alpha Testing is not known by any other 12 Beta Testing is also known by the name
different name. Field Testing means it is also known as field
testing.
a
13. It is considered as the User Acceptance 13. It is also considered as the User
Testing (UAT) which is done at developer‘s Acceptance Testing (UAT) which is done at
em
Special tests:
Se
GUI testing
Regression Testing
1) Regression Testing: Regression testing a black box testing technique that consists of re-
executing those tests that are impacted by the code changes. ii. These tests should be
executed as often as possible throughout the software development life cycle. Types of
Regression Tests:
i. 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.
20
UNIT-II TYPES AND LEVELS OF TESTING
ii. 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.
al
GUI testing is the process of ensuring proper functionality of the graphical user
interface (GUI ) for a given application and making sure it conforms to its written
im
specifications.
In addition to functionality, GUI testing evaluates design elements such as layout,
colors, fonts, font sizes, labels, text boxes, text formatting, captions, buttons, lists,
icons, links and content.
Ka
GUI testing processes can be either manual or automatic, and are often performed by
third -party companies, rather than developers or end users.
GUI is what user sees. A user does not see the source code. The interface is visible to
a
the user. Especially the focus is on the design structure, images that they are working
properly or not.
em
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, menu bars,
Se
21
UNIT-II TYPES AND LEVELS OF TESTING
i. This type of testing usually done for 2 tier applications (usually developed for LAN)
Here we will be having front-end and backend.
ii. The application launched on front-end will be having forms and reports which will be
monitoring and manipulating data.E.g: applications developed in VB, VC++, Core
Java, C, C++, D2K, PowerBuilder etc.,
iii. The backend for these applications would be MS Access, SQL Server, Oracle,
Sybase, Mysql, Quadbase. iv. The tests performed on these types of applications
would be– User interface testing Manual support testing– Functionality testing–
al
Compatibility testing & configuration testing – Intersystem testing.
im
a Ka
em
Se
In Client-server testing there are several clients communicating with the server.
1. Multiple users can access the system at a time and they can communicate with the server.
2. Configuration of client is known to the server with certainty.
3. Client and server are connected by real connection.
Testing approaches of client server system:
22
UNIT-II TYPES AND LEVELS OF TESTING
1. Component Testing: One need to define the approach and test plan for testing client and
server individually. When server is tested there is need of a client simulator, whereas testing
client a server simulator, and to test network both simulators are used at a time.
2. Integration testing: After successful testing of server, client and network, they are
brought together to form system testing.
3. Performance testing: System performance is tested when number of clients is
communicating with server at a time. Volume testing and stress testing may be used for
testing, to test under maximum load as well as normal load expected. Various interactions
al
may be used for stress testing.
4. Concurrency Testing: It is very important testing for client-server architecture. It may be
im
possible that multiple users may be accessing same record at a time, and concurrency testing
is required to understand the behavior of a system in this situation.
5. Disaster Recovery Business continuity testing: When the client server are
communicating with each other , there exit a possibility of breaking of the communication
Ka
due to various reasons or failure of either client or server or link connecting them. The
requirement specifications must describe the possible expectations in case of any failure.
6. Testing for extended periods: In case of client server applications generally server is
a
never shutdown unless there is some agreed Service Level Agreement (SLA) where server
may be shut down for maintenance. It may be expected that server is running 24X7 for
em
extended period. One needs to conduct testing over an extended period to understand if
service level of network and server deteriorates over time due to some reasons like memory
leakage.
7. Compatibility Testing: Client server may be put in different environments when the users
Se
are using them in production. Servers may be in different hardware, software, or operating
system environment than the recommended. Other testing such as security testing and
compliance testing may be involved if needed, as per testing and type of system.
Describe use of load testing and stress testing to online result display facility of MSBTE
website.6M
Ans: Stress Testing: In stress testing of MSBTE online result display, the resources used
will be less than the requirement. For e.g. Provide less RAM for the server, or
decrease the bandwidth of the internet connection, or provide less hits for page. If the
23
UNIT-II TYPES AND LEVELS OF TESTING
system has limited resources available, the response of the online result system may
deteriorate due to non-availability of the resources. It tries to break the page, site or
connection under test by overwhelming its resources in order to find the circumstances
under which it will crash. It is also a type of load testing. It is designed to determine
the behavior of the software under abnormal situations. In stress testing test cases are
designed to execute the system in such a way that abnormal conditions.
Load Testing: When a MSBTE online result display facility is tested with a load that
causes it to allocate its resources in maximum amounts. The idea is to create an
al
environment more demanding than the application would experience under normal
workloads. Eg. Apply more number of hits on the result section, try displaying
im
multiple results in multiple browsers, etc. Load is varied from minimum to the
maximum level the system can sustain without running out of resources. Load is being
increased transactions may suffer excessive delays. Load testing involves simulating
real-life user load for the target application. It helps to determine how application
Ka
behaves when multiple students hits it simultaneously to check the results. Load
Bidirectina; testing , client server, unit testing
a
Testing on WEB Application
em
Se
24
UNIT-II TYPES AND LEVELS OF TESTING
Web application testing, a software testing technique exclusively adopted to test the
applications that are hosted on web in which the application interfaces and other
functionalities are tested.
Web Application Testing - Techniques:
(1) Functionality Testing - The below are some of the checks that are performed but not
limited to the below list:
Verify there is no dead page or invalid redirects.
First check all the validations on each field.
al
Wrong inputs to perform negative testing.
Verify the workflow of the system.
im
Verify the data integrity.
(2) Usability testing - To verify how the application is easy to use with.
Test the navigation and controls.
Content checking.
Ka
Check for user intuition.
(3) Interface testing - Performed to verify the interface and the dataflow from one system to
other.
a
(4) Compatibility testing- Compatibility testing is performed based on the context of the
application.
em
Browser compatibility
Operating system compatibility
Compatible to various devices like notebook, mobile, etc.
(5) Performance testing - Performed to verify the server response time and throughput under
Se
25
UNIT-II TYPES AND LEVELS OF TESTING
al
(6) Security testing - Performed to verify if the application is secured on web as data
theft and unauthorized access are more common issues and below are some of the
im
techniques to verify the security level of the system.
Ka
a
em
Se
26
UNIT-II TYPES AND LEVELS OF TESTING
Questions:
1. What is Unit Testing?With the help of neat diagram, describe unit testing.
2. Explain unit test considerations
3. Explain unit test procedures.
4. Describe how drivers and stubs can be used in unit testing with neat diagrams
5. What is load testing and stress testing? Describe with respect to system testing?
6. What is Functional Testing?
al
7. What is non-functional testing?
8. Distinguish between functional and non-functional testing.
im
9. What is Acceptance Criteria?
10. Describe any four testing approaches of web application.
11. Explain Client-Server testing
Ka
12. Describe how to perform GUI testing.
13. How to perform security testing? State elements of security testing.
14. Compare alpha testing and beta testing.
15. Explain top –down testing.
a
16. Explain bottom-up testing
em
17. Illustrate process of bi-directional integration testing. State its two advantages and
disadvantages.
18. Describe bidirectional/sandwich integration testing with neat diagram.
19. Write a short note on special tests.
Se
27