PizzaScript
Browser Automation & Webpage Performance Testing
PizzaScript is a JavaScript browser automation framework that records detailed webpage performance metrics.
It uses the Chrome DevTools Extensions API, so no external driver is required.
It includes:
- A JavaScript IDE, for interactively writing and debugging tests.
- A standalone script runner, for running a set of tests, capturing screenshots & performance metrics.
- A Java API for embedding the script runner in your own projects. This is useful if you want customize how scripts are run or if you just want to write the automation scripts directly in Java instead of JavaScript.
Features
- Run site automation scripts and generate performance reports
- Inspect page load times and HTTP traffic
- Take screenshots
- Block/redirect certain URLs (or block all beacon URLs)
- Modify request headers
- Emulate Mobile and Tablet devices
- Emulate network conditions (e.g. 3G/4G/Offline)
- Record WebSocket request/responses
- Jenkins Integration
Try It!
First make sure the following are installed:
- Chrome 40+
- Java 8 JRE
Download the latest PizzaScript release.
Open the IDE:
bin/pizzascript-ide
Run all the example scripts and generate a report:
bin/pizzascript scripts
Examples
Load a Page
b = pizza.open("www.google.com");
b.verifyText("Search");
b.verifyText("Search");
Form Submission
b = pizza.open();
b.open("loadtestgo.com");
b.click("button:contains(Login)");
b.waitPageLoad();
b.type("#inputUsername", "demo@loadtestgo.com");
b.type("#inputPassword", "password");
b.click("button:contains(Login):nth(1)");
b.waitPageLoad();
b.open("loadtestgo.com");
b.click("button:contains(Login)");
b.waitPageLoad();
b.type("#inputUsername", "demo@loadtestgo.com");
b.type("#inputPassword", "password");
b.click("button:contains(Login):nth(1)");
b.waitPageLoad();
Load a Page While Emulating a Mobile Browser
b = pizza.open();
b.emulateDevice("Apple iPhone 6");
b.open("cnn.com");
b.emulateDevice("Apple iPhone 6");
b.open("cnn.com");
Alternatives
- Lighthouse - Auditing and performance metrics for Progressive Web Apps.
- PhantomJS - Drive a headless browser using JavaScript, take screenshots and capture performance metrics.
- WebPageTest - Test a site's peformance from many different locations with a wide variety of browsers.