Arrange-Act-Assert

Arrange-Act-Assert structures a test in three steps: prepare the context (Arrange), run the action under test (Act), then verify the result (Assert). This split makes a test readable and focused on a single behavior.

Example

test('total', () => {
  const panier = new Panier();
  panier.ajouter(10);
  expect(panier.total()).toBe(10);
});

Related concepts

The whole glossary