Testing and continuous integration
แนะนำใหม่
คำศัพท์
| English | ความหมาย |
|---|---|
| test pyramid | A testing guideline favouring many fast unit tests and fewer broader integration and end-to-end tests. |
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}
ฝึกฝน
The pyramid puts — at the base
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
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}
ฝึกฝน
Branch coverage is the honest number because —
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
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}
ฝึกฝน
Due = borrow date + 21 is tested at the unit level with —
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Pure function: normal, leap February, year boundary.