Skip to main content

How to Run Your Tests Headless with Xvfb

Intro

If you want to run your tests headless on a Continuous Integration (CI) server you'll quickly realize that you can't with an out-of-the-box setup since there is no display output for the browser to launch in.

A Solution

In order to run your tests using a browser that's loaded on your CI Server you will need to configure your tests to launch the browser virtually (e.g., using something like Xvfb).

An Xvfb primer

Xvfb (short for X virtual framebuffer) is an in-memory display server forUNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server) while also having the ability to take screenshots.

Let's take a look at an example.