New Relic Synthetics Monitoring Using Selenium

What is New Relic Synthetics Monitoring? It allows us to simulate user behavior on development, staging, and production websites using Selenium, and monitor web application performance. New Relic Synthetics Monitoring collects various data points from load times, load size, failures, https status codes, downtimes, and more when running Selenium on your web application. The data gives more insight into how your web application is performing by testing from various locations around the world, and repeating the test every minute or "x" minutes. The goal of Synthetics Monitoring is to catch problems before your customers do.

The Ins and Outs of Synthetics Monitoring

Continuously monitoring the performance of web applications helps ensure that web services are in place and working correctly and error-free by running automated tests on a set schedule. The monitors are virtual Chrome browsers executing Selenium tests once a minute in Washington, D.C., or every 15 minutes from Portland, Oregon. You have control over how frequently and from what locations your Selenium tests will be executed. With every execution, the monitor is recording each check in detail, and collecting performance data on your web application for each selected location. It captures aggregate numbers, including an overview, results, detailed statistics for each page resource, and downtime incidents (a.k.a. violations). Let's take a closer look at some of the monitoring dashboard sections...

The Synthetics Overview page gives you enough metrics to immediately realize how your website is performing. You can look up trends for load time, availability (uptime), slowest results, and failures. You can jump straight into the slowest results and failures for a deeper analysis.

The Synthetics Results page allows you to view individual monitor results. The default page setting sorts the list of identified slowest network timing (page load) for all geographic locations being monitored. The network timing graph below gives us a snapshot of how a page was performing and trending over a period (time picker filter—last 3 days).

The Synthetics Resources page allows us to understand the load time impact of each resource on your website1. We can review and investigate the load time of resources such as CSS, Javascript, images, HTML and more. You can look into a specific resource by drilling into detailed metrics collected at run-time to pinpoint the performance issue. This page also collects performance information for time spent by third-party resources, and HTTP response codes for each resource.

Use the Synthetics Failures page to locate and troubleshoot downtime incidents or other errors. It provides a list of violation incidents that occurred when executing monitoring type.

The central focus of this article is Scripted Browser Synthetics, but it is important to know there are four types of Synthetics monitors available to you:

Ping monitors check that your site is accessible.

Simple Browser monitors send a virtual browser to your site to ensure it’s working for real end-users.

API monitors for your API endpoints to ensure your app server works as well as your website

Configure and Develop a Selenium Scripted Browser Test

Using scripted browsers, you can build complex monitoring workflows using the Selenium JavaScript Webdriver bindings. For instance, log into the application, navigating to a particular link, and wait for a specific page element to load and add an assertion. For a detailed guide to all available functions, see this Synthetics Scripted Browser reference. Let’s me show you how to configure a scripted monitor.

Conclusion

We want our web application to operate error-free all the time, and want users to continue returning. New Relic Synthetics monitoring allows us to monitor our website performance proactively in real time, and receive instant alerts when things go wrong. Then, we can make things right by troubleshooting the detailed data collected, logs, and the captured screenshot when a failure has been encountered on the site to determine how to fix the issue.

Greg Sypolt (@gregsypolt) is a Senior Engineer at Gannett – USA Today Network and co-founder of Quality Element. He has spent most of his career working as a developer in test— concentrating on automated testing for web browsers, APIs, mobile, and more. He is focused on the research, creation, and deployment of automated test strategies, testing frameworks, tools, and continuous integration. He’s passionate about #TestAutomation #TestCoverage #ContinuousIntegration #DevOps