O'Reilly logo

Using WebPageTest by Marcel Duran, Andy Davies, Rick Viscomi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Continuous Integration

In software engineering, continuous integration (CI) can be defined as the practice of merging all developer working copies with a shared repository several times a day. It performs automated unit tests in build servers to improve software quality through frequent small efforts.

WebPageTest can be integrated into a CI pipeline to test web pages in the build or staging server. It can be used to indicate when the performance of web pages has regressed. Such integration can be done by customizing the running and reading of tests, as described in Chapter 9.

A common workflow would be to run WebPageTest after the CI pipeline successfully builds and all unit tests pass. Using either polling or pingback to retrieve WebPageTest results, some metrics from the full results set should be compared against expected metrics. For example, data.median.firstView.firstPaint must be less than 800 ms, or data.median.firstView.domElements must be between 800 and 1,000.

In this chapter, you will first learn how to consume WebPageTest API endpoints via the command line or as a Node.js application. You will also learn how to easily automate the whole process of running a test and reading its results in order to integrate with some popular CI tools.

Node.js Wrapper

webpagetest is a Node.js package available on NPM (package manager for Node.js). It provides a wrapper around the WebPageTest RESTful API with the following features:

  • Normalizes API endpoints and parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required