๐Ÿงช

Seven Principles of Testing

Jul 3, 2024

Lecture: Seven Principles of Testing

Introduction

  • Seven guiding principles for software testing
  • Important to understand these principles for effective testing

Principle 1: Testing Shows the Presence of Defects

  • Testing demonstrates defects but cannot prove absence of defects
  • Cannot claim a software is defect-free
  • Reduces risk of failure but cannot eliminate it
  • Example: "White swans" analogy

Principle 2: Exhaustive Testing is Impossible

  • Testing all combinations of inputs/preconditions is unfeasible
  • Instead, testing efforts focus on risks and priorities
  • Use test design techniques like boundary value analysis, equivalence partitioning
  • Examples:
    • One-digit numeric field with 68-70 tests
    • 15 input fields with 5 possible values each requiring an impractical number of tests

Principle 3: Early Testing

  • Start testing activities as early as possible in SDLC
  • Early defect detection is cheaper and more efficient
  • Helps prevent costly fixes later
  • Defined objectives for different phases:
    • Integration/system defects during development
    • User acceptance testing (UAT) to meet end-user requirements
    • Maintenance testing to ensure no new defects are introduced (regression testing)
    • Production testing to assure availability and reliability

Principle 4: Defect Clustering

  • A small number of modules contain most defects
  • Common in complex/tricky code areas
  • Use historical defect data for risk assessment and planning

Principle 5: Pesticide Paradox

  • Repeated use of the same tests will find fewer new bugs over time
  • Regularly review, revise, and add new test cases
  • Shift focus once 'hotspots' are cleaned up

Principle 6: Testing is Context Dependent

  • Different testing approaches for different types of software
  • Examples:
    • Family website: ad hoc testing
    • E-commerce site: more thorough testing, use of tools, and stringent guidelines
    • Safety-critical applications: strict guidelines and comprehensive testing

Principle 7: Absence of Error Fallacy

  • Defect-free software is not useful if it doesn't meet user needs
  • User satisfaction should be the goal
  • Software should be usable and fulfill user expectations

Conclusion

  • Recap of seven principles:
    1. Presence of defects
    2. Exhaustive testing impossibility
    3. Early testing
    4. Defect clustering
    5. Pesticide paradox
    6. Context dependency
    7. Absence of error fallacy