Software Testing
Chapter 1: Introduction to Software Testing
1.1 What is Software Testing?
Software Testing is a systematic process aimed at evaluating the functionality,
performance, and security of a software application to ensure it meets specified
requirements. It involves executing the program with the intent of identifying bugs and
verifying that the software behaves as expected under defined conditions.
1.2 Why is Testing Necessary?
   •   Detects software defects early.
   •   Validates that the system performs its intended functions.
   •   Ensures customer satisfaction.
   •   Enhances software reliability and quality.
   •   Reduces maintenance costs by fixing issues before deployment.
1.3 Merits and Demerits
Merits:
   •   Enhances product reliability.
   •   Increases confidence in software.
   •   Helps in delivering a product aligned with client expectations.
   •   Early defect detection reduces post-release defects.
Demerits:
   •   Can be resource-intensive.
   •   Time-consuming.
   •   May not uncover all hidden defects.
   •   Requires skilled resources.
Diagram:
   [User Requirements]
          |
    [Software Development]
          |
     [Software Testing]
          |
     [Release Product]
Chapter 2: Testing Objectives
   •     Error Detection: Locate defects before software reaches end-users.
   •     Verification: Confirm if the product meets design specifications.
   •     Validation: Ensure that software meets the actual business needs.
   •     Quality Assurance: Validate that the software achieves quality standards.
   •     Defect Prevention: Minimize future risks by addressing defects early.
   •     Cost Reduction: Mitigating defects earlier reduces cost overruns.
Additional Goals:
   •     To measure software performance.
   •     To check for usability and accessibility compliance.
   •     To evaluate system behavior under adverse conditions.
Chapter 3: Levels of Testing
3.1 Unit Testing
   •     Performed by developers.
   •     Involves testing individual modules in isolation.
   •     Techniques: Control path testing, Data flow testing.
   •     Tools: JUnit (Java), NUnit (.NET), Google Test (C++).
Merits:
   •     Detects code-level defects early.
   •     Simplifies debugging.
Demerits:
   •     Limited in scope.
   •     Can miss integration issues.
3.2 Integration Testing
   •     Performed after unit testing.
   •     Combines individual units and tests their interaction.
Types:
   •     Top-Down Integration: Begins with the top module; uses stubs.
   •     Bottom-Up Integration: Starts from the lower modules; uses drivers.
   •     Big Bang Integration: Integrates all modules simultaneously.
   •   Sandwich/Hybrid Integration: Combines top-down and bottom-up.
3.3 System Testing
   •   Validates complete and fully integrated software.
   •   Includes testing for performance, security, recovery.
3.4 Acceptance Testing
   •   Final testing before delivery.
   •   Alpha Testing: Done at developer’s site by internal staff.
   •   Beta Testing: Done by actual users in a real environment.
3.5 Regression Testing
   •   Ensures that new code changes do not adversely affect existing functionalities.
   •   Automated tools often used due to repetitive nature.
Chapter 4: Functional and Structural Testing
4.1 Black Box Testing (Functional)
   •   Focuses on system functionality without internal code knowledge.
Techniques:
   •   Equivalence Class Partitioning.
   •   Boundary Value Analysis.
   •   Cause-Effect Graphing.
   •   Decision Table Testing.
Example: Testing a login form for valid and invalid credentials.
4.2 White Box Testing (Structural)
   •   Involves detailed knowledge of code structure.
Techniques:
   •   Statement Coverage.
   •   Branch Coverage.
   •   Path Coverage.
   •   Loop Testing.
Example: Checking every path in a decision-making routine.
4.3 Cyclomatic Complexity
Quantifies the number of independent paths in the program.
Formula: V(G) = E - N + 2P Where:
   •     E = Number of edges
   •     N = Number of nodes
   •     P = Number of connected components.
Merits:
   •     Identifies critical paths.
   •     Assists in determining minimum number of test cases.
Demerits:
   •     Can be computationally intensive for large programs.
Chapter 5: Performance and Regression Testing
5.1 Performance Testing
Assesses system behavior under expected and stress conditions.
Types:
   •     Stress Testing: Tests beyond normal operational limits.
   •     Load Testing: Tests system behavior under expected load.
   •     Volume Testing: Handles large amounts of data.
   •     Scalability Testing: Measures the application’s ability to scale.
Merits:
   •     Ensures system reliability.
   •     Detects bottlenecks before deployment.
Demerits:
   •     Requires high-cost infrastructure.
   •     Time-consuming.
5.2 Regression Testing
   •     Done after code modifications.
   •     Ensures unchanged areas remain functional.
Types:
   •   Corrective Regression Testing.
   •   Progressive Regression Testing.
   •   Selective Regression Testing.
Tools: Selenium, QTP, JUnit.
Chapter 6: Static Testing Strategies
6.1 Formal Technical Reviews (FTR)
   •   Structured group review.
   •   Objectives: Detect defects, ensure standards.
6.2 Walkthrough
   •   Informal review by author explaining software artifacts.
   •   Objective: Familiarize reviewers with work.
6.3 Code Inspection
   •   Formal review for logic, syntax errors.
Checklist Includes:
   •   Correct initialization.
   •   Proper control structures.
   •   Error handling.
6.4 Compliance Checks
   •   Ensures code adheres to project and coding standards.
Merits:
   •   Early defect detection.
   •   Quality improvement.
Demerits:
   •   Reviewer training needed.
   •   Can slow initial phases.
Chapter 7: Test Data Suite Preparation
Involves designing input data sets for exhaustive testing.
Data Categories:
   •     Valid Data: Meets requirements.
   •     Invalid Data: Triggers error handling.
   •     Boundary Data: Tests edge limits.
   •     Stress Data: Beyond normal operation.
Example:
   •     Input values: 0, 100, 101 for a system allowing 1-100.
Merits:
   •     Improves test coverage.
   •     Supports automated testing.
Demerits:
   •     Large data sets can be hard to manage.
Chapter 8: Automated Testing
Use of automation tools to execute predefined test cases.
Merits:
   •     Faster test cycles.
   •     Better repeatability.
   •     Useful for regression.
Demerits:
   •     High initial setup cost.
   •     Maintenance overhead.
Popular Tools:
   •     Selenium, LoadRunner, JUnit, QTP.
Types:
   •     Functional Testing Automation.
   •     Performance Testing Automation.
Chapter 9: Debugging Techniques
Locating, analyzing, and correcting defects.
Methods:
   •     Brute Force: Adding print statements.
   •     Backtracking: Trace backward from error.
   •     Cause Elimination: Remove probable causes.
   •     Program Slicing: Focus on affected code areas.
Merits:
   •     Improves software reliability.
Demerits:
   •     Can be tedious and time-consuming.
Tools:
   •     GDB, WinDbg, Visual Studio Debugger.