Why Should I Run My Selenium Tests in Headless?

  Oktober 08, 2019

Headless testing is greatly underutilized – here are three quick ways it can increase performance

Selenium has grown to be one of the most popular automation tools available today. It automates many tasks needed for online testing, including checking titles, navigating pages, clicking links, and much more. Many developers already use the full set of capabilities Selenium offers, but few know about running their tests in headless browsers. And even fewer actually deploy this approach in their daily testing. With headless testing you can increase your testing performance to an all-time high.

What is Headless testing?

Headless testing is simply running your Selenium tests using a headless browser. It operates as your typical browser would, but without a user interface, making it excellent for automated testing.

How does Headless testing benefit developers?

There are several benefits, actually. They can create new testing opportunities, as well as accelerate tests you’re already running.

Benefits include:

  • Greater testing reach
  • Improved speed and performance
  • Multitasking

Greater testing reach

When running Selenium tests, you typically need a machine that supports the graphics of the web browser that you’re testing on. With headless testing we get rid of this need and open up a whole new set of devices to test on. Ex. Servers, docker containers, etc.

Improved speed and performance

Selenium tests can take a while to complete, due to elements on a page that the browser needs to load. Headless testing gets rid of this load time, allowing you to cut your testing times significantly. In our tests with headless testing, we’ve seen a 30% reduction of test execution times. And you can use other techniques, like running more tests in parallel, to amplify that benefit.

Multitasking

Running normal Selenium tests take up your screen time, keeping you from being able to accomplish anything else on that device. With the UI disabled, headless testing lets you continue to use your computer while the tests execute in the background.

In our conversations with customers, we’ve found that headless testing has let developers experience all of these benefits – and many more!

How have you used headless testing to improve your processes? And where do you see opportunities to take advantage of them? Respond in the comments!

To help you get started Headless testing with CrossBrowserTesting, visit our help page: Headless Testing Documentation