lecture 15 of 180 completed

The test that only fails on the build server

Selenium saves no evidence by itself. Make every failure leave a screenshot and a log, then repeat it on your machine.

What you'll learn

  • How to investigate a failure you cannot reproduce
  • What evidence Selenium collects, which is nothing by default
  • How to tell an environment problem from a test problem

A test fails on the build server about once in ten runs. On your machine it passes every time. Someone runs the build again, it passes, and the team moves on. Two weeks later the same test blocks a release.

Do not move on. Selenium records nothing about a run by itself: no screenshots, no video, no logs. So your first job is to make every failure leave evidence behind.

Where this code runs. The examples below go in your own Selenium project, in Node, with Mocha as the test runner. They read and write files, so they cannot run in the editor on this site.

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 →