Software Testing Concepts
1. Functional vs. Structural Testing
Functional Testing (Black-Box Testing)
- Tests the software based on its external specifications (what it should do).
- Does not require knowledge of internal code.
- Example: Testing a login feature by entering username and password.
Structural Testing (White-Box Testing)
- Tests the internal structure (code, logic, and components).
- Requires knowledge of the software's implementation.
- Example: Checking if all loops and conditions in a function work correctly.
Gray-Box Testing
- A mix of both black-box and white-box testing.
- Example: Testing a module’s functions (black-box) while also checking how they interact
(white-box).
2. Usage-Based Testing (Operational Profile - OP)
- Tests the software based on real-world usage scenarios.
- Uses statistical sampling to simulate how users interact with the system.
- Applied in final testing stages (system/acceptance testing).
- Termination Criteria: Testing stops when reliability goals are met.
- Example: If 80% of users use the "Search" feature, testing focuses more on that feature.
3. Coverage-Based Testing
- Tests the software based on code or feature coverage.
- Ensures all parts (functions, statements, branches) are tested.
- Used in early stages (unit testing) and later phases for critical parts.
- Termination Criteria: Testing stops when coverage goals (e.g., 90% branch coverage) are
met.
- Example: Making sure every "if-else" condition in a function is tested.
4. Steps in Systematic Testing
- Define a Model (e.g., flowcharts, decision tables).
- Check Individual Elements (identify what to test).
- Derive Test Cases (create inputs to test each part).
- Execute Tests & Analyze Results (compare actual vs. expected output).
5. Test Case Preparation
Individual Test Cases:
- Derived from models (e.g., input-output pairs).
- Example: Testing a calculator’s "Add" function with (2, 3) → 5.
Test Suite (Collection of Test Cases):
- Organizes test cases hierarchically.
- Example: A suite for "Login Functionality" includes test cases for valid/invalid inputs.
Test Procedure Preparation:
- Determines the order of test execution (simple to complex).
- Example: Test basic features before advanced ones.
6. Test Execution
Allocating Test Time:
- Based on usage (OP) or coverage goals.
Invoking Tests:
- OP-Based: Randomly selects test cases based on real-world probabilities.
- Coverage-Based: Follows a structured path (e.g., testing all branches).
Identifying Failures:
- Checks if actual output matches expected.
- Example: A crash, wrong calculation, or slow response is a failure.
7. Test Analysis & Follow-Up
Analyze Test Results:
- Identify defects (bugs) and their severity.
Follow-Up Actions:
- Fix defects → Re-test to confirm fixes.
- Adjust testing strategy if needed.
Decision Making:
- Decide whether to exit testing (if goals are met) or continue (if more issues exist).
8. Test Management
Roles in Testing:
- Informal Testing: Ad-hoc testing by users or testers.
- Formal Testing: Structured testing by dedicated teams.
Team Organization:
- Vertical (Project-Based): Testers focus on one product.
- Horizontal (Task-Based): Testers specialize in one type of testing (e.g., security).
Third-Party Testing:
- Independent testers (e.g., beta testers, external QA teams).
9. Test Automation
Why Automate?
- Speeds up repetitive tests (e.g., regression testing).
- Improves accuracy (no human errors).
Areas for Automation:
- Test Execution: Running predefined test scripts.
- Test Case Generation: Creating test cases from models.
- Coverage Measurement: Tools like McCabe (checks code paths).
Limitations:
- Not all tests can be automated (e.g., usability testing).
10. Summary & Next Lecture Preview
Key Takeaways:
- Testing can be functional (black-box) or structural (white-box).
- Usage-based testing mimics real-world usage, while coverage-based ensures all code is
tested.
- Test management involves planning, execution, analysis, and automation.
Next Lecture:
- Will cover Checklist and Partition-Based Testing (a structured way to design test cases).