Software Testing
Software Testing
Software Testing is the process of executing a program with the intent of finding errors and ensuring that the software works as per requirements.
In simple words: Testing = Checking whether software works correctly
Testing Objectives
Main Objectives of Software Testing
- Find defects and errors
- Verify software meets requirements
- Ensure software quality
- Reduce risk of failure
- Improve customer satisfaction
Secondary Objectives
- Validate performance and reliability
- Check security and usability
- Ensure compatibility
Unit Testing
Unit Testing tests individual units or modules of software separately.
Usually done by developers
Features
- Focuses on smallest part of software
- Uses test cases
- Detects errors early
Advantages
- Easy debugging
- Low cost
- Improves code quality
Example: Testing a function that calculates salary.
Integration Testing
Integration Testing checks whether combined modules work together correctly.
Types of Integration Testing
| Type | Description |
|---|---|
| Top-Down | Main module tested first |
| Bottom-Up | Low-level modules tested first |
| Sandwich | Combination of both |
| Big Bang | All modules tested together |
Advantages
- Finds interface errors
- Ensures smooth data flow
Acceptance Testing
Acceptance Testing is done to confirm that software meets user expectations.
Performed by users or clients
Types
- Alpha Testing (in-house)
- Beta Testing (real users)
Purpose
- Final validation
- User approval
Regression Testing
Regression Testing ensures that new changes do not break existing functionality.
When Performed?
- After bug fixing
- After feature addition
- After system update
Importance
- Maintains software stability
- Prevents reintroduction of old bugs
Testing for Functionality
Functional Testing checks what the software does against requirements.
Focus Areas
- Input validation
- Output correctness
- Business rules
- Error handling
Types of Functional Testing
- Unit Testing
- Integration Testing
- System Testing
- Acceptance Testing
Testing for Performance
Performance Testing checks how well the software performs under load.
Key Performance Parameters
- Response time
- Throughput
- Scalability
- Resource usage
Types of Performance Testing
| Type | Description |
|---|---|
| Load Testing | Normal expected load |
| Stress Testing | Extreme conditions |
| Volume Testing | Large data volume |
| Endurance Testing | Long time usage |
Functional vs Performance Testing (Very Important)
| Basis | Functional Testing | Performance Testing |
|---|---|---|
| Focus | What system does | How system performs |
| Requirement Type | Functional | Non-functional |
| Example | Login works or not | Login speed |
Quick Revision Table
| Testing Type | Purpose |
|---|---|
| Unit Testing | Test individual modules |
| Integration Testing | Test combined modules |
| Acceptance Testing | User approval |
| Regression Testing | Check impact of changes |
| Functional Testing | Validate features |
| Performance Testing | Measure speed and load |
Important Exam Questions
- Define software testing and its objectives
- Explain unit and integration testing
- What is regression testing?
- Differentiate functional and performance testing
- Explain acceptance testing
Conclusion
Software testing ensures reliable, high-quality software. Different testing types focus on correctness, performance, and user satisfaction, helping reduce failures and improve system stability
Top-Down Testing Strategy
Top-Down Testing starts testing from the top-level module and gradually moves to lower-level modules.
Focus: Testing the main functionality first, then sub-modules.
How it works
- Start testing the main module.
- Use Test Stubs for modules that are not yet developed.
- Gradually integrate and test lower modules.
Test Stubs
- Definition: A dummy module that simulates the behavior of a lower-level module.
- Used because lower modules may not be ready yet.
Real-life example: Imagine building a car. You want to test driving before engine is ready. You attach a dummy engine (stub) that simulates movement, so you can test steering and brakes.
Advantages
- High-level design tested early
- Early detection of design flaws
- Suitable for major functionality verification
Disadvantages
- Requires many stubs
- Low-level modules tested late
Bottom-Up Testing Strategy
Bottom-Up Testing starts with testing lower-level modules first and then integrates to form higher modules.
Focus: Test basic units first, then the whole system.
How it works
- Test basic modules individually.
- Use Test Drivers to simulate higher-level modules.
- Integrate modules step by step and test.
Test Drivers
-
A program that calls and tests a lower-level module before higher modules are ready.
Real-life example: In a car, you first test the engine separately using a test rig (driver) before installing it in the car to see if it works.
Advantages
- Errors in low-level modules detected early
- Early testing of critical modules
Disadvantages
- Integration issues detected late
- Higher-level design tested late
Structural Testing (White Box Testing)
White Box Testing tests internal logic, code structure, and paths of the program.
Also called Glass Box Testing / Code-Based Testing
Key Techniques
- Statement Coverage
- Branch Coverage
- Path Coverage
- Loop Testing
Real-life example
Checking a banking software code to ensure if–else decisions for withdrawal, deposit, and loan approval are all correct.
Functional Testing (Black Box Testing)
Black Box Testing checks software behavior without knowing the internal code.
Focus: Does the system do what it’s supposed to do?
Types of Functional Testing
- Unit testing
- Integration testing
- System testing
- Acceptance testing
Real-life example
Testing a microwave oven: You just press buttons and see if it heats food. You don’t care about circuits inside.
Test Data Preparation
Test Data is input data used to test software. Proper preparation is critical to cover all scenarios.
Types of Test Data
- Valid Data – Correct input
- Invalid Data – Incorrect input to check error handling
- Boundary Data – Edge cases (max/min values)
- Random Data – Random values to test robustness
Real-life example
Testing ATM withdrawal:
- Valid: ₹500 (less than balance)
- Invalid: ₹5000 (more than balance)
- Boundary: ₹0, ₹Max limit
Alpha and Beta Testing of Products
Alpha Testing
- Done in-house by developers before release
- Simulates real users
- Helps catch bugs early
Real-life example: Software company releases a new mobile app internally to employees before public launch.
Beta Testing
- Done by actual users in real environment
- Feedback collected for final improvements
- Precedes final release
Real-life example: Company releases a beta version of WhatsApp to selected users to test new features.
Quick Revision Table
| Concept | Definition | Example |
|---|---|---|
| Top-Down Testing | Test high-level modules first | Testing car steering before engine ready |
| Bottom-Up Testing | Test low-level modules first | Testing engine separately before car assembly |
| Test Stub | Dummy lower module | Dummy engine in top-down |
| Test Driver | Dummy higher module | Engine test rig in bottom-up |
| White Box Testing | Test internal code | Bank software if-else logic |
| Black Box Testing | Test functionality | Microwave oven buttons |
| Test Data | Input used for testing | ATM withdrawal amounts |
| Alpha Testing | In-house user testing | Internal beta of mobile app |
| Beta Testing | Real user testing | Selected users test new WhatsApp features |
Important Exam Questions
- Explain top-down and bottom-up testing strategies
- Define test drivers and test stubs with examples
- Difference between white box and black box testing
- Explain test data preparation types
- Explain alpha and beta testing with examples
Conclusion
Testing strategies ensure software works correctly, meets user expectations, and is stable. Top-Down & Bottom-Up approaches, combined with proper test data, and alpha/beta testing, provide comprehensive quality assurance.
Static Testing Strategies
Static Testing is the process of examining software artifacts without executing the code.
In simple words: Static Testing = Finding defects by reviewing documents, design, and code, instead of running the program.
Objectives of Static Testing
- Detect errors early in development
- Ensure compliance with standards
- Reduce cost of fixing defects
- Improve overall software quality
- Check for consistency and completeness
Types of Static Testing
| Strategy | Description | Real-Life Example |
|---|---|---|
| Formal Technical Reviews (Peer Reviews) | A structured review of software artifacts by team members | Team checks each other’s design document before coding |
| Walkthrough | Informal step-by-step presentation of code/design for discussion | Developer explains code logic to colleagues to spot mistakes |
| Code Inspection | Detailed line-by-line examination of code | Senior developer reviews every line of banking software code for logic errors |
| Compliance with Design & Coding Standards | Check if code/design follows organizational standards | Ensuring variable names, indentation, comments, and naming conventions are followed |
Formal Technical Reviews (Peer Reviews)
A Formal Technical Review (FTR) is a structured peer review of software artifacts such as:
- Requirements document
- Design document
- Code
Steps
- Planning the review
- Kick-off meeting
- Individual preparation (reviewer studies the artifact)
- Review meeting (discuss defects)
- Defect logging
- Follow-up (verify fixes)
Advantages
- Early defect detection
- Improves quality
- Knowledge sharing among team
Real-Life Example
A team reviews a Student Management System design document and finds missing modules like attendance tracking.
Walkthrough
Walkthrough is an informal review where the author explains the artifact step-by-step to the team.
Purpose
- Understand logic
- Find errors or missing requirements
- Educate team members
Example
A developer explains login module code to colleagues to check for logic flaws.
Code Inspection
Code Inspection is a line-by-line examination of source code by one or more reviewers.
Key Points
- Focuses on logical, syntactical, and semantic errors
- Follows a checklist
Advantages
- Finds subtle errors
- Improves maintainability
- Ensures coding standards
Real-Life Example
Inspecting banking application code to detect errors in interest calculation formula.
Compliance with Design and Coding Standards
Ensuring that code and design conform to organizational rules and best practices.
Key Aspects
- Naming conventions (variables, functions)
- Commenting and documentation
- Proper indentation
- Code modularity and reuse
Real-Life Example
In a hospital management system, all modules must follow standard naming patterns and error handling conventions.
Advantages of Static Testing
- Detect defects early → cheaper to fix
- Reduces risk of failures in later stages
- Improves team understanding of software
- Ensures standardization
Static Testing vs Dynamic Testing (Quick Exam Table)
| Basis | Static Testing | Dynamic Testing |
|---|---|---|
| Execution | No code execution | Code is executed |
| Cost | Early, cheaper | Late, more expensive |
| Focus | Documents, code, design | Software behavior |
| Example | Peer review, walkthrough | Unit testing, system testing |
Important Exam Questions
- Define static testing and its objectives
- Explain formal technical review (peer review) with steps
- What is walkthrough? Give example
- Explain code inspection and its advantages
- How is compliance with design and coding standards verified?
Conclusion
Static Testing is a cost-effective method to improve software quality by detecting errors early, reviewing artifacts, and ensuring standards are followed. Methods like peer reviews, walkthroughs, code inspections, and compliance checks are widely used in software projects.