lecture 16 of 190 completed

Debugging a failure from its trace

A trace records enough to find the cause of a failure you never saw. It only helps if the run kept it, so start with the settings.

What you'll learn

  • What a trace records beyond a screenshot
  • The order to read one in
  • How to classify a failure before digging

A test failed once, three days ago, on a build machine that no longer exists. Nobody can reproduce it. If the run saved a trace, you can still find the cause. If it did not, you are guessing.

A trace is a recording of one test run. It stores every action, what the page looked like before and after each one, the network requests, and the console output. You open it later in Playwright's trace viewer.

Step 1: make sure the evidence exists.

Traces are switched on in playwright.config.ts, the project's settings file:

full course

Keep reading with the full course

The Foundations track and the first lessons in each framework are free. This lesson needs full course access. A course plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →