SOFTWARE TESTING APPROACHES
Complete Guide to Testing Methodologies
By Dr. Mohit
What is Software Testing?
Software testing is a systematic process of evaluating a software application to identify bugs,
ensure requirements are met, and verify that the product works as intended. It involves
executing software components using manual or automated tools to evaluate one or more
properties of interest.
Key Objectives
Ensure Quality
✓
Find Defects
Identify bugs and errors before release Verify software meets requirements
Prevent Issues Build Confidence
Catch problems early in development Provide assurance to stakeholders
Why Software Testing
Matters Testing Benefits
The Cost of Poor Testing
Reduces development costs
80%
of bugs found in production cost 100x more to fix
Improves product quality and reliability
than in development Enhances security and data protection
$2.84T
Global cost of poor software quality annually (CISQ
Increases customer satisfaction
Protects brand reputation
Report)
60%
Ensures compliance with standards
Provides documentation of system behavior
of software projects fail due to inadequate testing
Software Testing Life Cycle
(STLC)
1 2 3
Requirement Analysis Test Planning Test Case Development
Understand testable requirements Define test strategy and resources Create detailed test scenarios
4 5 6
Environment Setup Test Execution Test Closure
Prepare test infrastructure Run tests and log defects Evaluate exit criteria and report
Strategic Approach to
Software Testing
A strategic approach to testing means having a well-defined plan that aligns testing activities
with business objectives, project timelines, and quality goals.
Test Strategy Test Planning Test Design
Define testing objectives Create test plan document Design test cases
Select appropriate test levels Define scope and schedule Prepare test data
Choose testing types Identify risks Define test environment
Allocate resources Establish metrics Create automation framework
The Testing Pyramid
Strategy
Test Distribution Model Why This Distribution?
Unit Tests (Base)
▸ Fast execution (milliseconds)
▸ Low cost to maintain
E2E Tests ▸ Pinpoint exact failures
10% ▸ Run during development
Integration Tests (Middle)
▸ Test component interactions
Integration Tests
▸ Moderate execution time
20% ▸ Balance of speed and coverage
▸ Catch integration bugs
E2E Tests (Top)
Unit Tests
▸ Simulate real user scenarios
70% ▸ Slow and expensive
▸ Brittle and hard to maintain
▸ Critical path coverage only
Testing Approaches Overview
Technique-Based Level-Based Execution-Based
Unit, Integration, System,
Black Box, White Box, Grey Box Manual, Automated
Acceptance
Strategy-Based Change-Based Non-Functional
Static, Dynamic Regression, Smoke, Sanity Performance, Load, Stress, Security
Black Box Testing
Definition & Key Points Practical Example
Login Form Requirements:
• Testing without knowing internal code • Username: 6-12 characters
structure • Password: minimum 8 characters
• Focus on requirements, input, output, and
behavior Test Cases:
• Used in: Functional, System, and Username = 6 chars (boundary)
Acceptance testing Username = 5 chars (invalid)
Password = 8 chars (valid)
Password = 7 chars (invalid)
White Box Testing
Definition & Focus Code Example
• Testing internal structure of code
• Focus Areas: if marks >= 90:
• Code coverage grade = "A"
• Branch coverage elif marks >= 50:
grade = "B"
• Path coverage
else:
• Loop coverage grade = "Fail"
Test Cases:
• marks = 95 (A branch)
• marks = 70 (B branch)
Grey Box Testing • marks = 30 (Fail branch)
Partial knowledge of internal system. Example: Tester
Goal: Cover all decision branches
knows system uses MySQL and passwords are encrypted,
tests login via UI but checks DB values.
Level-Based Testing: Unit & Integration
Unit Testing Integration Testing
Definition:
Testing interaction between modules
Definition:
Testing smallest testable component
Types: Top-down, Bottom-up, Big Bang
Done by: Developers
E-commerce Example:
Example:
Modules:
def calculate_tax(amount):
• Order Module
return amount * 0.18
• Payment Module
• Inventory Module
Test Cases:
• Input: 1000 → Output: 180
Test Flow:
• Input: 0 → Output: 0
Place order → Payment successful
→ Inventory reduced
Only testing this function, not full application
If inventory not updated → Integration bug
System & Acceptance Testing
System Testing Acceptance
Validation Testing
by client or end-user
Testing complete application as a whole
Types:
Banking System Example: • UAT (User Acceptance Testing)
• Register account • Alpha Testing
• Login to system • Beta Testing
• Transfer money
• Logout Client checks: Report format, Business rules,
Compliance
Ensures system meets all requirements
If approved → System goes live
Testing Level Progression
Level Scope Performed By
Unit Single component Developers
Integration Module interaction Developers/QA
System Complete application QA Team
Execution-Based Testing
Manual Testing Automated Testing
Definition:
Definition: Testing using tools/scripts
Human executes test cases
Popular Tools:
Activities: • Selenium (Web automation)
• Clicks buttons • JUnit (Java unit testing)
• Fills forms • TestNG (Testing framework)
• Checks UI alignment • PyTest (Python testing)
• Exploratory testing
Example:
Best For: Selenium script logs into website automatically
• Usability testing every day
• Ad-hoc testing
• UI/UX validation Used In:
• One-time test scenarios • Regression testing
• CI/CD pipelines
• Repeated test scenarios
Strategy-Based Testing
Static Testing Dynamic Testing
Testing by executing program
Testing without executing code
Process:
Includes:
1. Run the application
• Code review
2. Provide inputs
• Requirement review
3. Check actual outputs
• Walkthrough
4. Compare with expected results
• Inspection
Example:
Example:
Running a calculator application and verifying that 5
Review SRS (Software Requirements Specification)
+ 3 returns 8
document to find missing or unclear requirements
Includes:
Benefits:
• Functional testing
• Early defect detection
• Integration testing
• Cost-effective
• System testing
• Improves quality before coding
• Performance testing
Change-Based Testing
Regression Smoke Sanity
Testing specific bug fix
Testing old features after changes Basic testing of critical functionalities
Focus:
When: Purpose: Narrow and deep - only
After code modifications, bug fixes, or Quick check if build is stable for affected area
new features detailed testing
Example:
Example: Example: Login crash fixed
New payment gateway added. Test: After new build:
• Old UPI • App opens Tester checks:
• Net Banking • Login works Only login feature, not full
• Credit Card • Dashboard loads system
Ensure nothing breaks! If smoke fails → Build rejected Quick verification after bug fix
✓
Non-Functional Testing
Performance Testing Load Testing
Checks: Speed, Response time, Throughput System tested with expected user load
Example: Example:
Website response time < 2 seconds Testing with 10,000 concurrent users
Stress Testing Security Testing
Testing beyond normal capacity Check for vulnerabilities and security flaws
Example: Examples:
1,00,000 users (system may fail but should recover • SQL Injection • Cross-site scripting •
gracefully) Authentication bypass
UNIT TESTING
Testing Individual Components in Isolation
The Foundation of Software Quality
Unit Testing: Deep Dive
Unit testing validates individual units or components of software in isolation. A unit is the smallest
testable part of an application—typically a function, method, or class. Tests are automated, fast,
and run frequently during development.
Key Characteristics Best Practices
Follow AAA pattern: Arrange, Act, Assert
Fast Milliseconds per test
Test one behavior per test case
Isolated No external dependencies
Use descriptive test names
Repeatabl
Same result every time Keep tests independent
e
Self- Mock external dependencies
Pass/fail automatically
Checking
Aim for high code coverage (80%+)
Focused One thing at a time
Run tests in CI/CD pipeline
Unit Testing: Practical
Example
Code Under Test (JavaScript) Unit Tests (Jest Framework)
// [Link]
describe('Calculator', () => {
// [Link]
test('adds two numbers', () => {
function add(a, b) { expect(add(2, 3)).toBe(5);
return a + b; });
}
test('divides two numbers', () => {
function divide(a, b) { expect(divide(10, 2)).toBe(5);
if (b === 0) { });
throw new Error('Division by zero');
} test('throws error on divide by zero', () => {
expect(() => divide(10, 0))
return a / b;
.toThrow('Division by zero');
}
});
});
Key Takeaway:
Each test validates one specific behavior. Tests are independent, fast, and clearly named to describe what they
verify.
INTEGRATION TESTING
Testing Component Interactions
Ensuring Modules Work Together Correctly
Integration Testing: Deep
Dive
Integration testing verifies that different modules or components of a system work correctly
together. It focuses on interfaces, data flow, and communication between integrated units,
catching issues that unit tests miss.
Integration Approaches
Big Bang Top-Down Bottom-Up Sandwich
Test all modules together at Test from top-level modules Test from lowest modules Combine top-down and
once down up bottom-up
✓ Fast integration ✓ Early UI testing ✓ No stubs needed ✓ Best of both worlds
✗ Need stubs for lower
✗ Hard to isolate defects ✗ Late UI testing ✗ More complex setup
modules
Integration Testing: Practical
Example
Scenario: E-commerce Order Processing System
test('Complete order flow', async () => {
System Components: Integration
// Arrange Test Example:
const order = {
items: [{ id: 1, quantity: 2 }],
OrderService Creates and validates orders
total: 100
};
PaymentService Processes payments
// Act
const result = await orderService
.createOrder(order);
InventoryService Manages stock levels
// Assert
expect([Link]).toBe('confirmed');
NotificationService Sends confirmations
expect([Link]).toBe(true);
expect([Link]).toBe(8);
expect([Link]).toBe(true);
});
What's Being Tested:
✓ Data flows correctly between services
✓ Payment is charged before inventory update
✓ Notification sent after successful order
✓ All services work together as expected
Unit Testing vs Integration
Testing
Aspect Aspect Unit Testing Unit Testing Integration Testing
Integration Testing
Scope Single component Multiple components
Dependencies Mocked/stubbed Real or partially real
Speed Very fast (ms) Slower (seconds)
Complexity Simple More complex
Isolation Complete isolation Tests interactions
Debugging Easy - pinpoints exact issue Harder - multiple components
Cost Low Medium
When to Run Every code change Before integration/deployment
Coverage Code paths Integration points
Both are essential! Unit tests catch bugs early and cheaply. Integration tests ensure components
work together correctly.
Testing Tactics: Practical
Techniques Behavior-Driven Development
Test-Driven Development (TDD)
(BDD)
Write tests before code Describe behavior in plain language
▸ 1. Write failing test ▸ Given initial state
▸ 2. Write minimal code to pass ▸ When action occurs
▸ 3. Refactor ▸ Then expected outcome
✓ Better design, higher coverage ✓ Shared understanding, living documentation
Mocking & Stubbing Continuous Testing
Isolate code under test Automate in CI/CD pipeline
▸ Mock: verify interactions ▸ Run on every commit
▸ Stub: return predefined data ▸ Fast feedback loops
▸ Spy: track calls ▸ Block bad deployments
✓ Fast, reliable, focused tests ✓ Catch issues immediately
Common Testing Pitfalls to
Avoid
Testing Implementation
Details
Tests break when refactoring, even if ✓ Test behavior and outputs, not internal implementation
behavior is unchanged
Too Many E2E Tests ✓ Follow test pyramid: most unit, some integration, few E2E
Slow, brittle, expensive to maintain
Ignoring Test Maintenance
Tests become outdated, flaky, and ✓ Treat test code with same care as production code
ignored
Testing Everything
Wastes time on trivial tests ✓ Focus on business logic, edge cases, and critical paths
(getters/setters)
No Test Data Strategy ✓ Use test fixtures, factories, or database seeding
Tests fail randomly due to data issues
Unclear Test Names ✓ Use descriptive names that explain the scenario and expectation
Hard to understand what failed and why
Popular Testing Tools &
Frameworks
Unit Testing
Jest JavaScript/TypeScript Built-in mocking, snapshot testing
JUnit Java Industry standard, extensive ecosystem
pytest Python Simple syntax, powerful fixtures
NUnit .NET/C# Parallel execution, data-driven tests
Integration Testing
Postman/Newman API Testing REST API testing, CI/CD integration
TestContainers Multiple languages Docker-based integration tests
Spring Test Java/Spring Dependency injection, DB testing
Supertest [Link] HTTP assertion library
Summary: Testing Approaches
Category Testing Types
Technique-Based Black Box, White Box, Grey Box
Level-Based Unit, Integration, System, Acceptance
Execution-Based Manual, Automated
Strategy-Based Static, Dynamic
Change-Based Regression, Smoke, Sanity
Non-Functional Performance, Load, Stress, Security
Key Takeaway
Software testing approaches can be categorized into technique-based, level-based, execution-based, strategy-based,
change-based, and non-functional testing. Each approach ensures software quality from different perspectives.
THANK YOU
Quality Assurance through Comprehensive Testing