Unit-V
Software Testing
Software Testing is a process used to evaluate a software application to ensure it works
correctly, meets requirements, and is free from defects (bugs).
Software is tested to uncover errors that were made inadvertently as it was designed and
constructed.
Definition
Software testing is the process of executing a program with the intent of finding errors and
verifying that the software meets specified requirements.
a) Manual Testing
Testing done by humans without tools
Example: checking UI manually
b) Automated Testing
Uses tools/scripts to test software
Example: Selenium
Objectives of Software Testing
To detect defects and errors
To ensure the software meets requirements
To verify quality, reliability, and performance
To build confidence in the software product
Classification of Testing Types
Software testing is broadly classified into:
A. Functional Testing
Focuses on what the system does (features and functionality).
B. Non-Functional Testing
Focuses on how the system performs (performance, usability, security).
Functional Testing Types
1. Unit Testing
Tests individual components or modules
Usually performed by developers
Example: Testing a login function
Ensures each unit works correctly in isolation
2. Integration Testing
Tests interaction between modules
Types: Top-down, Bottom-up, Sandwich
Example: Login module + database interaction
Detects interface defects
3. System Testing
Tests the complete integrated system
Performed in a real-like environment
Ensures system meets functional requirements
4. Acceptance Testing
Done by users/customers
Types:
o Alpha Testing (in-house)
o Beta Testing (real users)
Confirms system meets user expectations
Non-Functional Testing Types
1. Performance Testing
Evaluates system speed and stability
Types:
Load Testing – Normal expected load
Stress Testing – Extreme load
Scalability Testing – Growth capability
Ensures system handles workload efficiently
2. Security Testing
Identifies vulnerabilities
Protects data from unauthorized access
Important for banking, e-commerce systems
3. Usability Testing
Evaluates user-friendliness
Focus on UI/UX
Ensures ease of use
4. Compatibility Testing
Tests software across:
o Devices
o OS
o Browsers
Ensures consistent behavior
Testing Based on Approach
a) Black Box Testing
No knowledge of internal code
Focus on input and output
Example: Checking login with valid/invalid credentials
b) White Box Testing
Knowledge of internal code
Tests logic, paths, conditions
Example: Testing loops and conditions
c) Grey Box Testing
Partial knowledge of system
Combines black-box and white-box advantages
Other Important Testing Types
1. Regression Testing
Re-tests system after changes
Ensures new code doesn’t break existing features
Very important in agile development
2. Smoke Testing
Basic functionality check
Done after a new build
Ensures build is stable for further testing
3. Sanity Testing
Focused testing on specific changes
Confirms bug fixes or enhancements
4. Exploratory Testing
No predefined test cases
Tester explores system dynamically
Useful for uncovering hidden defects
5. Ad-hoc Testing
Informal testing without planning
Quick defect detection but less structured
Advantages of Software Testing
Improves quality of software
Reduces maintenance cost
Ensures customer satisfaction
Detects bugs early
Software Testing Explained with Examples
1. Unit Testing
Definition: Testing individual components or functions of a program.
Example:
def add(a, b):
return a + b
Test cases:
add(2, 3) → 5
add(-1, 1) → 0
Here, only the function is tested, not the whole system.
2. Integration Testing
Definition: Testing how different modules work together.
Example:
Module 1: Login system
Module 2: Dashboard
Test:
After login → Does it correctly open the dashboard?
If login works but dashboard doesn’t open → integration issue.
3. System Testing
Definition: Testing the complete system as a whole.
Example:
For an online shopping system:
Login
Add to cart
Payment
Order confirmation
Check if the entire flow works correctly.
4. Acceptance Testing
Definition: Testing done by the user/client to verify requirements.
Example:
Client requirement:
“User should be able to pay using UPI”
Test:
Try payment using UPI
If successful → Accepted
Done before final delivery.
🔹 Based on Approach
5. Black Box Testing
Definition: Testing without knowing internal code.
Example:
Login page:
Enter correct username/password → Login success
Enter wrong password → Error message
Tester doesn’t know how code works internally.
6. White Box Testing
Definition: Testing internal logic and code structure.
Example:
if marks >= 40:
print("Pass")
else:
print("Fail")
Test cases:
marks = 50 → Pass
marks = 30 → Fail
Ensures all code paths are tested.
7. Grey Box Testing
Definition: Partial knowledge of internal code.
Example:
Tester knows database structure but not full code:
Checks login using database values
🔹 Other Important Testing Types
8. Regression Testing
Definition: Ensures new changes don’t break existing features.
Example:
New feature added: “Dark Mode”
Check: Login, cart, payment still working
Old features must remain unaffected.
9. Performance Testing
Definition: Checks system speed and response under load.
Example:
1000 users login at same time
System should not crash
10. Security Testing
Definition: Checks system for vulnerabilities.
Example:
Try SQL Injection in login:
username: admin' --
System should block unauthorized access
11. Usability Testing
Definition: Checks how easy the system is to use.
Example:
Is the “Buy Now” button easy to find?
Is navigation simple?
12. Manual Testing
Definition: Testing done manually without tools.
Example:
Tester clicks buttons and checks outputs
13. Automated Testing
Definition: Testing using tools/scripts.
Example:
Using Selenium to automatically test login page
Online Shopping System – Testing Types with Examples
Assume system features:
Login/Register
Search product
Add to cart
Payment
Order confirmation
🔹 1. Unit Testing
Definition: Testing individual components.
Example:
Function: calculateTotalPrice()
Input: items = ₹500 + ₹300
Output: ₹800
Only this function is tested independently.
🔹 2. Integration Testing
Definition: Testing interaction between modules.
Example:
Add to Cart + Payment module
Test: Item added → correctly passed to payment page
If price not shown in payment → integration issue.
🔹 3. System Testing
Definition: Testing the complete system.
Example:
User logs in → searches product → adds to cart → pays → gets confirmation
Entire workflow is tested end-to-end.
🔹 4. Acceptance Testing
Definition: Testing by client/user.
Example:
Requirement: “User should receive order confirmation SMS/email”
Test:
Place order → check confirmation message
If working → system accepted.
🔹 Based on Code Knowledge
🔹 5. Black Box Testing
Definition: Testing without knowing code.
Example:
Login page:
Correct credentials → login success
Wrong password → error message
Focus only on input/output.
🔹 6. White Box Testing
Definition: Testing internal logic.
Example:
Discount logic:
if price > 1000:
discount = 10%
else:
discount = 0
Test:
₹1200 → discount applied
₹800 → no discount
All code paths are checked.
🔹 7. Grey Box Testing
Definition: Partial knowledge of system.
Example:
Tester knows database stores user data
Tries login using database values
🔹 Other Important Testing Types
🔹 8. Regression Testing
Definition: Ensures new updates don’t break old features.
Example:
New feature: “Wishlist” added
Test: Login, cart, payment still working
🔹 9. Performance Testing
Definition: Tests system under load.
Example:
During sale, 10,000 users use system
Check: Website speed, response time
Should not crash.
🔹 10. Security Testing
Definition: Checks system safety.
Example:
Try accessing another user’s account
Try fake payment
System should block unauthorized actions.
🔹 11. Usability Testing
Definition: Checks ease of use.
Example:
Is “Add to Cart” button easy to find?
Is checkout process simple?
🔹 12. Manual Testing
Definition: Testing done by human.
Example:
Tester manually places an order and verifies result
🔹 13. Automated Testing
Definition: Testing using tools.
Example:
Script automatically logs in, adds product, checks cart