New Relic Synthetics Monitoring Using Selenium
Sauce AI for Test Authoring: Move from intent to performance in transactions.|xBack to ResourcesBlogPo
Sauce AI for Test Authoring: Move from intent to performance in transactions.
|
x
What is New Relic SyntheticsMonitoring? It allows us to simulate user behavior on growth, staging, and production websites use Selenium, and monitor web application performance. New Relic Synthetics Monitoring collects various data points from load times, load size, failures, https position codes, downtimes, and more when extend Selenium on your web application. The data gives more insight into how your web application is do by testing from various location around the world, and repeating the test every minute or & quot; x & quot; 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 insure that web services are in property and work correctly and error-free by running machine-driven tests on a set docket. The monitors are practical Chrome browser fulfil Selenium tests once a minute in Washington, D.C., or every 15 minutes from Portland, Oregon. You receive check over how frequently and from what placement your Selenium tests will be execute. With every execution, the monitor is recording each check in item, and collecting execution datum on your web application for each selected emplacement. It captivate aggregate number, including an overview, results, elaborated statistics for each page resource, and downtime incident (a.k.a. violations). Let & # x27; s take a closer aspect at some of the monitoring dashboard sections ...
The Synthetics Overviewpage give you enough metrics to immediately realize how your website is performing. You can look up trends for load clip, accessibility (uptime), slowest termination, and failures. You can jump straight into the slowest results and failures for a deeper analysis.
The Synthetics Resultspage permit you to view case-by-case monitor results. The default page setting sorts the list of identified obtuse mesh timing (page load) for all geographic locations being monitor. The mesh clock graph below gives us a snapshot of how a page was performing and trending over a period (time selector filter—last 3 days).
The Synthetics Resourcespage permit us to understand the load time wallop of each resource on your website1. We can critique and investigate the load clip of resourcefulness such as CSS, Javascript, images, HTML and more. You can look into a specific imagination by drilling into detailed metrics collected at run-time to pinpoint the execution issue. This page besides collects performance information for clip pass by third-party resourcefulness, and HTTP response codification for each imagination.
Use the Synthetics Failurespage to locate and troubleshoot downtime incidents or other fault. It provides a list of infringement incidents that occurred when fulfill monitoring case.
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:
Pingmonitors check that your site is accessible.
Simple Browsermonitors mail a virtual browser to your site to see it ’ s working for existent end-users.
Scripted Browsersnavigate your site and assure particular resources are present using Selenium scripting
SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.
APImonitors for your API endpoints to ensure your app server act as well as your website
Configure and Develop a Selenium Scripted Browser Test
Using scripted browsers, you can build complex monitoring workflows utilize the Selenium JavaScript Webdriver bindings. For example, log into the application, navigating to a especial link, and wait for a specific page element to freight and add an statement. For a elaborate guidebook to all available mapping, see this Synthetics Scripted Browser reference. Let ’ s me show you how to configure a written proctor.
It starts by selecting monitoring type(e.g., Scripted Browser)and specifying a monitor name(e.g., Sitename.com Scripted Browser):
Select the locations from which you want your monitor to run (select Washington, DC, USA and Portland, OR, USA):
Choose a oftenness to determine how ofttimes each location will run your Selenium monitor (select 5 minutes):
Set a notification method to alarm your team when performance violations occur:
Now you & # x27; re ready to write your Selenium script:
var assert = require (& # x27; chai & # x27;) .assert;
// Script-wide timeout for all delay and waitAndFind role (in ms)
var DEFAULT_ELEMENT_TIMEOUT = 190000; //3 mins
var DEFAULT_PAGELOAD_TIMEOUT = 240000; //4 mins
var navLinks =[& quot; css-locator-1 & quot;, & quot; css-locator-2 & quot;];
//sets element load timeout to 3 Fukien
$ browser.manage () .timeouts () .implicitlyWait (DEFAULT_ELEMENT_TIMEOUT);
//sets page load timoeout to 4 mins
$ browser.manage () .timeouts () .pageLoadTimeout (DEFAULT_PAGELOAD_TIMEOUT);
//Test all the main Nav page performances
$ browser.get (& quot;http: //www.sitename.com & quot;) .then (function () {
return $ browser.findElement ($ driver.By.className (& quot; site-theme-example & quot;));
}) .then (purpose () {
//Verifies the nav list has loaded
regress $ browser.findElement ($ driver.By.className (& quot; site-nav-list-example & quot;));
}) .then (function () {
//loops through the navLinks raiment
navLinks.forEach (function (val, i, arr) {
//finds and navigates to each navLink page
return $ browser.findElement ($ driver.By.className (navLinks[i])) .click () .then (function () {
//verifies that the nav list loaded before moving on
return $ browser.findElement ($ driver.By.className (& quot; site-nav-list-example & quot;)) .then (function () {
//verifies that the page logotype footer at bottom of page has loaded
retrovert $ browser.findElement ($ driver.By.className (& quot; site-footer-logo & quot;));
})
})
})
});
Conclusion
We want our web application to operate error-free all the time, and want users to keep returning. New Relic Synthetics monitoring countenance us to monitor our website execution proactively in real clip, and receive instant alerting when things go wrong. Then, we can make things right by troubleshooting the elaborate 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 pass most of his career working as a developer in test— concentrating on machine-driven testing for web browser, APIs, mobile, and more. He is focused on the inquiry, creation, and deployment of automated test strategy, testing fabric, tools, and uninterrupted integrating. He ’ s passionate about # TestAutomation # TestCoverage # ContinuousIntegration # DevOps
Automate This With SUSA
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.
Try SUSA FreeTest Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free