Testing and continuous integration
Đã giới thiệu
Từ vựng
| English | Ý nghĩa |
|---|---|
| test pyramid | test pyramid |
English
The pyramid
- The test pyramid: many unit tests (fast, isolated), fewer integration tests (real database), few end-to-end tests (the whole app). CI runs them on every push: red blocks the merge.

{exercise:uni-cs1205-pyramid}
Luyện tập
The pyramid puts — at the base
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Many fast units, fewer integration, few slow end-to-end.
English
Coverage, honestly
- Line coverage counts executed lines; branch coverage counts decided branches. The course suite: 92% line, 81% branch — the branch number is the honest one (each untested branch is an untested behaviour).
- The gate at 85% line blocks merges; the uncovered branch list is the work queue. A test without an assertion is coverage theatre.
{exercise:uni-cs1205-coverage}
Luyện tập
Branch coverage is the honest number because —
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
92% line with 81% branch: the gap is decisions never exercised.
English
FR-2 at all three levels
- Unit: due = borrow date + 21 — three cases (normal, leap February, year boundary). Integration: the loan lands and reads back. End-to-end: a scripted member borrows and sees the due date.
- Red-green in CI: push the failing sixth-borrow test, CI red; implement the limit check, green, coverage rises, merge unblocked. Assert behaviour (the due date), not internals.
{exercise:uni-cs1205-levels}
Luyện tập
Due = borrow date + 21 is tested at the unit level with —
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Pure function: normal, leap February, year boundary.