UNIT-4
SOFTWARE
TESTING
What is Testing?
“ Testing is the process of executing a program with the intent of
finding errors “
Who should do the testing?
The testing requires the developers to find errors from their
software.
Many organisations have distinguished the development and
testing phases by assigning different people to each phase.
What should we test?
• We should test the program’s responses to every possible input.
• It means we should test for all valid and invalid inputs.
Testing Objectives
• Finding defects
• the end result meets the user requirements.
• satisfies the SRS
• To gain the confidence of the customers
Principles of Software Testing
• Testing shows the presence of defects.
• Exhaustive testing is impossible
• Early testing
• Defect clustering
• The Pesticide Paradox
• Testing is context-dependent
• Absence of errors fallacy.
Some Terminologies
• Error: It is the human action that produces the incorrect result
that produces a fault.
• Bug: The presence of an error at the time of execution of
software.
• Fault: A state of software caused by an error.
• Failure: Deviation of the software from its expected result. It is
a failure
Software Testing Process
• Unit Testing
• Integration Testing
• System Testing
Unit Testing
• Unit tests are basically written and executed by software
developers.
• to make sure that code meets its design and requirements and
behaves as expected.
• Example:
• In a banking app, a function calculateInterest() is tested alone
• Input: ₹10,000 → Output: correct interest
• Done by developer
Advantages of Unit Testing
• Issues are found at an early stage
• Unit testing helps in maintaining and changing the code.
• It also helps in reducing the cost of bug fixes.
• helps in simplifying the debugging process.
Integration Testing
• It occurs after unit testing and before system testing.
• individual software modules are combined and tested as a
group.
• Example:
• Login module + Dashboard module
• After login, does user correctly reach dashboard?
Integration Testing Strategy
• Big bang integration (Non incremental).
• Incremental integration.
• Top-down integration
• Bottom-up integration
• Sandwich testing
System Testing
• It tests both functional & non-functional aspects of the product.
• It is performed on the basis of written test cases according to
information collected from SRS & detailed design documents.
• Example:
• Full e-commerce website
• User can:
• Login
• Add to cart
• Make payment
WHY System Testing?
• Bring in the customer perspective
• Build confidence in the product
• Analyse & reduce the risk of releasing the product
• Ensure product is ready for acceptance testing
Types of System Testing
• Alpha Testing
Done inside the company.
(ex. Developers test a new mobile app before release)
• Beta Testing
Done by real users.
(ex. Limited users use a new app and give feedback)
• Acceptance Testing
(ex. Testing by real users/client )
Differences between Alpha and Beta Testing
Regression Testing
• It means re-testing an application after its code has been
modified to verify that it still functions correctly.
• Example: Login System
Old feature: Login works fine(Username & Password)
Developer adds: “Login with OTP”
White Box testing
• The basic goal of white box testing is to verify a working flow
for an application. However, it is mainly applied to Unit Testing.
• White-box testing is also called as:
-Structural testing
-Code-Based Testing
-Clear testing
-Open testing
- Glass box testing
WHITE BOX TESTING ADVANTAGES
• Testing can be commenced at an earlier stage.
• Testing is more thorough, with the possibility of covering most
paths.
• It is easy to automate.
WHITE BOX TESTING
DISADVANTAGES
• costs are increased.
• missing functionality may not be discovered
• It is suitable for small projects.
Black Box Testing
• A black-box test takes into account only the input and output of
the s/w without regard to the internal code of the program.
Why Black Box Testing?
•Identifying any incomplete & inconsistent requirement.
•It handles valid & invalid inputs.
When to do Black Box Testing?
• Starts from the beginning of the s/w project life cycle
• Test scenarios & test data can be prepared when the s/w is in
the design phase.
Techniques for the effective Black Box
Testing are:
• Requirements-Based Testing
• Positive and Negative Testing
• Boundary Value Analysis
• Equivalence Partitioning
• State/Graph Based Testing
Grey Box Testing
▪ Partial knowledge
▪ Improved efficiency
A common technique used in grey box testing:
i. Matrix Testing (Analyse business risk factors)
ii. API & Database Testing (Test data flow & integration)
• Example:
The tester knows the database structure
Tests login + checks DB entries
Comparison Between Black-box and White-box Testing
Black Box White Box Grey Box
Testing Testing Testing
Internals are Internals are
Internals are
not known completely partially
+
known known to
the tester
Testing is
done from Testing is
the user done as a Testing is
perspective developer performed
from the
user
perspective
with access
to internals.
Execution Types
Manual Testing
Human testing without tools
• Example:
Tester manually clicks buttons and checks output
Automation Testing
Using tools/scripts
• Example:
Using Selenium to automatically test the login 100 times.
(Selenium is a free (open-source) automated testing framework used to validate web
applications across different browsers and platforms)
Functional vs Structural Testing
Functional Testing • Structural Testing
Checks what system does Checks how the system works
• Example: internally
ATM: • Example:
• Insert card Checking the code logic of
• Enter PIN the ATM withdrawal
• Withdraw money
Testing for Functionality
System testing begins with function testing
The guidelines for function testing should:
✔ identification of functions.
✔ creation of input data.
✔ determination of output.
✔ execution of the test case.
✔ comparison of actual and expected output.
Performance Testing
• Performance testing addresses the non-functional
requirements.
• It is performed to determine how fast some aspect of a system
performs under a particular workload.
• The focus of Performance testing is checking a software
program’s
1. Speed
2. Scalability
3. Stability
Static Testing
• Done by Humans or sometimes with the help of specialised
tools.
• Code works according to functional requirements.
• Code written in accordance with the design
• Code for any functionality has been missed out
• Code handles errors properly
Difference between static and dynamic
testing
Code Inspection
• It is a formal group review designed to identify problems
• It is used to improve the quality of product and to improve
productivity
Objectives of Inspection Process
• Find problems at the earliest possible point
• Verify that the work product meets its requirements.
• Increases the effectiveness of software testing.
IEEE recommends following roles:
• Inspection Leader
• Recorder
• Reader
• Author
• Inspector
Compliance with Design and Coding
Standards
• Programmer feels comfortable with the code written by others,
as it is similar to what he himself would have written.
• A person joining the group at a later stage can pick up the code
easily.
• Define the coding standard.
Real-life Example
(Food Delivery App)
• Unit Testing → Check “calculate bill” function
• Integration Testing → Delivery_App + Payment
Gateway(phonepay/UPI)
• System Testing → Full app testing
• Acceptance Testing → Users test app
• Black Box Testing→ Enter order → check delivery
• White Box Testing → Check backend code logic