Show understanding of the methods of testing available and select appropriate data for a given method.
Fault‑avoidance techniques are applied during design and coding; fault‑exposure techniques are applied during testing.
| Fault‑Avoidance (Design / Coding) | Fault‑Exposure (Testing) |
|---|---|
| Static analysis & code reviews | Unit testing – test each component in isolation. |
| Defensive programming (input validation, assertions, clear error messages) | Integration testing – check interactions between components. |
| Use of standard libraries & design patterns | System testing – validate the whole system against requirements. |
| Peer programming, pair reviews | Regression testing – re‑run previously successful tests after any change. |
| Error Type | Description | Typical Example |
|---|---|---|
| Syntax error | Violates language grammar; program will not compile/run. | Missing semicolon in Java: int x = 5 → int x = 5; |
| Logic error | Program runs but produces incorrect results. | Using < instead of <= in a range check. |
| Run‑time error | Occurs while the program is executing (exceptions, crashes). | Division by zero, ArrayIndexOutOfBoundsException in Java. |
| Approach | When to Use | Key Techniques |
|---|---|---|
| Black‑Box (Functional) | No knowledge of internal code – early development, acceptance testing. | Equivalence Partitioning, Boundary‑Value Analysis, Decision Tables, State‑Transition, Use‑Case/Scenario. |
| White‑Box (Structural) | Source code is available – aim for thorough structural coverage. | Statement, Branch, Path coverage; control‑flow graphs; condition coverage. |
| Grey‑Box | Partial knowledge (e.g., module interfaces) – a balance of depth and efficiency. | Combination of black‑box test design plus targeted white‑box checks. |
| Technique | Purpose | Typical Data Chosen |
|---|---|---|
| Equivalence Partitioning | Group inputs that are expected to behave the same. | One representative from each valid and invalid class. |
| Boundary‑Value Analysis | Target the edges of each equivalence class where errors are common. | Minimum, just‑above minimum, nominal, just‑below maximum, maximum. |
| Decision Table Testing | Model complex business rules as combinations of conditions and actions. | Rows for each unique combination of condition outcomes. |
| State‑Transition Testing | Validate behaviour of systems that change state in response to events. | Sequences that cause transitions through all states and back to the start. |
| Use‑Case / Scenario Testing | Check that typical user interactions produce correct results. | End‑to‑end sequences drawn from real‑world usage scenarios. |
| Testing Level | Recommended Data‑Selection Technique(s) |
|---|---|
| Unit Testing | Equivalence Partitioning, Boundary‑Value Analysis, White‑Box coverage (statement/branch). |
| Integration Testing | Decision Table (for interface contracts), State‑Transition (for protocol handling). |
| System Testing | Use‑Case / Scenario testing, Decision Tables for end‑to‑end business rules. |
| Acceptance Testing | Use‑Case / Scenario testing (real user stories). |
| Regression Testing | Reuse test cases from the level(s) being protected; focus on previously failed areas. |
Metrics show how much of the program’s structure has been exercised.
Statement Coverage = (Executed statements ÷ Total statements) × 100 %
Branch Coverage = (Executed decision outcomes ÷ Total decision outcomes) × 100 %
Generating coverage in the exam languages:
coverage.py (run coverage run … then coverage report).| Maintenance Type | Purpose | Typical Testing Activities |
|---|---|---|
| Corrective | Fix faults discovered after delivery. | Targeted unit tests for the corrected component + full regression suite. |
| Adaptive | Modify software to work in a changed environment (OS, hardware, regulations). | Integration testing of affected interfaces; system testing of the whole application in the new environment. |
| Perfective | Enhance performance, add new features, improve usability. | Use‑case / scenario tests for new features; regression tests for unchanged functionality. |
| Preventive | Improve maintainability (refactoring, code clean‑up). | Extensive regression testing; increase white‑box coverage (statement/branch) to ensure behaviour is unchanged. |
| Section | Content to Include |
|---|---|
| 1. Introduction | Purpose, reference documents, definitions. |
| 2. Test Items | List of modules, features, or user stories to be tested. |
| 3. Test Scope | In‑scope items, out‑of‑scope items, assumptions. |
| 4. Test Approach | Levels (unit, integration, system, acceptance, regression, maintenance), approaches (black/white/grey), data‑selection techniques. |
| 5. Test Resources | Personnel, hardware, software tools (IDE, coverage tools), test data. |
| 6. Schedule | Milestones, start/end dates for each testing level. |
| 7. Entry / Exit Criteria | Conditions to start testing (e.g., code compiled) and to stop (e.g., 95 % statement coverage, all critical defects fixed). |
| 8. Deliverables | Test cases, test scripts, test reports, defect logs, coverage reports. |
int grade(int mark)Specification
0 ≤ mark ≤ 100| Partition | Test Values (Boundary + Typical) |
|---|---|
| Invalid low | -1 |
| Invalid high | 101 |
| F (0–39) | 0, 1, 39 |
| D (40–49) | 40, 45, 49 |
| C (50–59) | 50, 55, 59 |
| B (60–69) | 60, 65, 69 |
| A (70–100) | 70, 85, 100 |
Conditions: mark < 0, 0 ≤ mark ≤ 39, 40 ≤ mark ≤ 49, 50 ≤ mark ≤ 59, 60 ≤ mark ≤ 69, 70 ≤ mark ≤ 100, mark > 100. Actions: return “Invalid”, “F”, “D”, “C”, “B”, “A”.
| Rule | mark < 0 | 0‑39 | 40‑49 | 50‑59 | 60‑69 | 70‑100 | mark > 100 | Action |
|---|---|---|---|---|---|---|---|---|
| 1 | Y | Invalid | ||||||
| 2 | Y | F | ||||||
| 3 | Y | D | ||||||
| 4 | Y | C | ||||||
| 5 | Y | B | ||||||
| 6 | Y | A | ||||||
| 7 | Y | Invalid |
From the decision table we select at least one representative value for each rule – e.g., -5 (Rule 1), 20 (Rule 2), 45 (Rule 3), 55 (Rule 4), 65 (Rule 5), 85 (Rule 6), 150 (Rule 7).
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.