Test Data and Fixture
Prepare fixed user and product data for the order test, and create it before every run and clean it after so the next run starts identically.
Prepare fixed user and product data for the order test, and create it before every run and clean it after so the next run starts identically.
users↳Test data is the row value; the fixture makes it appear on time and disappear afterward.
Test data supplies clear input and state: A registered user, cart with two items, and valid coupon are starting conditions. Fixed readable data makes failures reviewable instead of randomly different every run.
A fixture restores the same starting point: Fixtures organize account creation, order setup, dependency startup, and cleanup into a reusable mechanism. Cases write less duplicated setup and do not contaminate each other with leftovers.
Create an order-test fixture: before each test make a fixed user and pending-payment order, then clean up afterward. Keep concrete test data separate from setup/cleanup steps; run twice and confirm the second run is not affected by the first.