Loading…
Loading…
Charting your lesson…
Opening your lesson…
Software Testing Fundamentals
Lesson 2 of 3
6 steps•about 13 min•12 flashcards
Step 1/ 61 min
Untested code is a liability. Testing is how teams gain confidence that software works and stays working as it changes — and its vocabulary (unit vs integration, black-box vs white-box, the test pyramid) is common interview and exam ground.
Core idea: software testing systematically verifies that software behaves as intended and catches defects. Tests are organised by level (unit → integration → system → acceptance) and by knowledge of internals (black-box = test behaviour only; white-box = test with knowledge of the code).
Step 2/ 61 min
if both ways?"// Boundary values for "age >= 18": test 17, 18, 19 (the edges, where off-by-one hides)
The test pyramid guides the ratio: many fast unit tests at the base, fewer integration tests in the middle, and a small number of slow end-to-end tests at the top. Inverting it (mostly slow E2E tests — the "ice-cream cone" anti-pattern) yields brittle, slow suites. Related practices:
Step 3/ 61 min
Function: discount(age) returns 20% off if age >= 65, else 0.
> vs >=) bug would hide.Step 4/ 61 min
Common asks: "difference between unit and integration testing", "black-box vs white-box testing", "what is boundary value analysis / equivalence partitioning", "what is the test pyramid", "what is TDD / regression testing", and "does 100% coverage mean bug-free?" (no). Designing test cases for a given function is a frequent practical task.
Step 5/ 61 min
Treating code coverage as a proxy for quality — chasing 100% coverage and assuming the software is therefore bug-free. Coverage only measures which lines ran, not whether the tests asserted correct behaviour or covered the right edge cases. A test that executes a function but checks nothing meaningful inflates coverage while catching no bugs.
Step 6/ 6· Worked examples3 min
Problem
A function classify(age) returns "minor" for age < 18, "adult" for 18 ≤ age ≤ 64, and "senior" for age ≥ 65. Design a minimal but effective set of test cases using equivalence partitioning and boundary value analysis, and classify the levels (unit vs integration) and approaches (black-box vs white-box) involved.
def classify(age):
if age < 18: return "minor"
elif age <= 64: return "adult"
else: return "senior"
Try it on paper first.
Recall
Keep this
Testing knowledge signals engineering maturity — interviewers ask about "unit vs integration testing", "black-box vs white-box", and TDD. It's especially relevant as SDET and quality-focused roles grow.
| Level | Scope | Who |
|---|---|---|
| Unit | one component in isolation | developer |
| Integration | modules working together | developer/QA |
| System | the whole application | QA |
| Acceptance | meets business/user needs | user/business |
The test pyramid advises many fast unit tests, fewer integration tests, and few slow end-to-end tests.
Functional checks what the system does; non-functional checks how well (performance, security, usability, scalability).
TDD (Test-Driven Development) follows red → green → refactor: write a failing test, make it pass, then clean up. Regression testing re-runs tests to ensure new changes didn't break existing features.
"Unit vs integration testing", "black-box vs white-box", "what is TDD / the red-green-refactor cycle?", "what is regression testing?", and "functional vs non-functional testing".
Levels: unit (isolated) → integration (modules) → system (whole) → acceptance (business). Test pyramid = many unit, few E2E. Black-box (spec, no code) vs white-box (structure/coverage). TDD = red-green-refactor. Regression re-tests to catch breakage. Functional (what) vs non-functional (how well).
You've read 0 of 6 steps
Now lock it in — questions straight after reading are what make it stick.