UNIT I: FOUNDATIONS OF SOFTWARE
TESTING – Notes
Why Do We Test Software?
- Purpose: To identify and fix bugs, defects, or errors to ensure quality.
- Goals:
- Ensure correctness, performance, reliability, and security.
- Improve user satisfaction and prevent system failure.
- Types of Results:
- Pass – expected output received.
- Fail – actual output differs from expected.
Black-Box Testing
- Tests without knowledge of internal code.
- Focuses on input/output behavior.
- Techniques: Equivalence Partitioning, Boundary Value Analysis, Decision Table Testing.
White-Box Testing
- Tests with full knowledge of code structure.
- Focuses on internal logic and flow.
- Techniques: Statement Coverage, Branch Coverage, Path Coverage.
Software Testing Life Cycle (STLC)
1. Requirement Analysis
2. Test Planning
3. Test Case Development
4. Environment Setup
5. Test Execution
6. Test Cycle Closure
V-Model of Software Testing
- An extension of the waterfall model.
- Each development phase has a corresponding testing phase:
- Requirements → Acceptance Testing
- System Design → System Testing
- Architecture Design → Integration Testing
- Module Design → Unit Testing
Program Correctness and Verification
- Correctness: The program behaves as intended for all inputs.
- Verification: Ensures the software meets specifications (Are we building the product
right?).
- Includes formal methods, proofs, and validations.
Reliability vs Safety
- Reliability: Ability to function correctly under specific conditions for a period.
- Safety: Avoidance of catastrophic failures that harm people or the environment.
- Difference: A system can be reliable but not safe (e.g., consistent wrong decisions).
Failures, Errors, and Faults (Defects)
- Error (Mistake): Human action leading to incorrect result.
- Fault (Defect): Incorrect code or logic due to an error.
- Failure: Program does not behave as expected due to a fault.
Software Testing Principles
1. Testing shows presence of defects, not absence.
2. Exhaustive testing is impossible.
3. Early testing saves cost and time.
4. Defects cluster in certain modules.
5. Pesticide paradox: Repeating same tests won't find new bugs.
6. Testing depends on context.
7. Absence-of-errors fallacy – Finding no bugs doesn't mean useful product.
Program Inspections
- Static review of code, requirements, or design.
- Detects issues without executing code.
- Roles: Moderator, Author, Reviewer, Recorder.
- Types: Walkthroughs, Inspections, Reviews.
Stages of Testing
a) Unit Testing
- Tests individual units/modules.
- Done by developers.
- Tools: JUnit, NUnit.
b) Integration Testing
- Tests interaction between modules.
- Types: Top-Down, Bottom-Up, Sandwich, Big Bang.
c) System Testing
- Tests the complete integrated system.
- Performed by testers.
- Includes: Functional, Performance, Load, Security Testing.