You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers software testing strategies — the systematic approaches used to verify that software works correctly, meets requirements, and is free from defects. Testing is a critical part of the software development lifecycle and a key topic in A-Level Computer Science.
Testing is essential because:
Exam Tip: You should know the difference between verification (checking the software is built correctly — "are we building the product right?") and validation (checking the right software is built — "are we building the right product?"). Testing contributes to both.
Unit testing tests individual components (functions, methods, or classes) in isolation from the rest of the system. Each test checks that a single "unit" of code produces the correct output for a given input.
def add(a: int, b: int) -> int:
return a + b
# Unit tests
assert add(2, 3) == 5
assert add(-1, 1) == 0
assert add(0, 0) == 0
| Advantage | Disadvantage |
|---|---|
| Fast to run | Does not test interactions between components |
| Easy to isolate and fix bugs | Requires writing many individual tests |
| Can be automated | May miss integration-level bugs |
Integration testing tests the interactions between components that have already been unit tested. It verifies that modules work together correctly when combined.
| Approach | Description |
|---|---|
| Top-down | Start with high-level modules and integrate lower-level modules progressively, using stubs for untested modules. |
| Bottom-up | Start with low-level modules and integrate upwards, using drivers to simulate higher-level modules. |
| Big bang | Integrate all modules at once and test the whole system (risky — hard to isolate faults). |
# Integration test: does the login module work with the database module?
def test_login_integration():
db = Database()
db.add_user("alice", "password123")
auth = AuthService(db)
assert auth.login("alice", "password123") == True
assert auth.login("alice", "wrongpass") == False
System testing tests the complete, integrated system against the original requirements specification. It verifies that the whole system works as a unified product.
Acceptance testing (also called User Acceptance Testing / UAT) is performed by the end users or client to verify that the software meets their needs and is ready for deployment.
| Type | Description |
|---|---|
| Alpha testing | Performed by internal users within the development organisation. |
| Beta testing | Performed by a limited group of external users before public release. |
Exam Tip: Know the order of testing: Unit → Integration → System → Acceptance. Each level tests at a broader scope. Exam questions often ask you to explain the purpose of each level and how they differ.
Choosing the right test data is essential for thorough testing. There are three categories:
| Category | Description | Example (for a field accepting ages 0-120) |
|---|---|---|
| Normal (valid) | Data within the expected range | 25, 50, 100 |
| Boundary | Data at the edges of the valid range | 0, 1, 119, 120 |
| Erroneous (invalid) | Data outside the expected range or of the wrong type | -1, 121, "abc", 999 |
Boundary testing focuses on values at the edges of valid ranges, where errors are most likely to occur. For a valid range of 1-100:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.