Arrange-Act-Assert (AAA) เป็น pattern สำหรับการจัดโครงสร้าง test ให้ชัดเจนเป็นสามขั้น: Arrange (เตรียมการ) Act (ดำเนินการ) Assert (ตรวจสอบผลลัพธ์) มันทำให้ test อ่านง่าย เป็นระเบียบ และเข้าใจง่าย
สามขั้นตอน
ARRANGE → set up the test: create objects, prepare inputs, configure mocks, set state
ACT → perform the ACTION being tested (call the function/method under test)
ASSERT → verify the OUTCOME: check the result/behavior matches what's expected
→ A clear three-part structure for every test.
