Executing Selenium scripts in WebLOAD

Published by RadView on March 19, 2019

In the previous posts,  we explained the automation trends and the importance of running real browsers during load tests.

In order to achieve this goal, WebLOAD has the ability to execute Java Selenium scripts.

This can be used for 2 purposes:

  • Running many real browsers to create true load
  • Running a few real browsers to measure user experience while creating the massive load with protocol level scripts

There are a few ways to run Selenium with WebLOAD, the simplest one is to take the Java Selenium scripts and execute them in WebLOAD.

In order to that, small additional changes to the script are required to make it interact with WebLOAD. This can be done without breaking the original functionality – the enhanced script can still be executed in a regular automation environment where the additional changes are ignored.

WebLoadDriver

WebLoadDriver wraps WebDriver, implementing all WebDriver methods and enriches it with load testing functionality with dedicated methods.

For example:

WebLOAD Selenium

 

Note that except for wrapping the original driver with WebLOADDriver, the Selenium code stays the same.

Collecting Performance Metrics

WebLoadDriver has several capabilities which are important for performance testing.

Running real browser load is not enough for performance testing, collecting and measuring performance metrics is also needed.  WebLOADDrivers has the tools to do this.

The most important capabilities needed and are a part of WebLoadDriver are:

  • reportStatistics – This method interacts with the browser and collects the browser’s last navigation timings. It includes information such as load time, rendering time, dom integration, DNS time, time to first byte, etc.
  • Transactions – Transaction is a load testing concept that measures a whole business process from start to end. WebLoadDriver introduces 2 methods to deal with transactions: beginTransaction and endTransacation.

Let’s enhance the previous example with the performance metrics collection.

WebLOAD Selenium

 

That’s it! The selenium code is WebLOAD ready!

 

Just a reminder – this script is not limited to WebLOAD environment – It can still run in a regular automation environment where the WebLOAD extensions will be automatically ignored.

Executing Selenium scripts in WebLOAD

When the Java Selenium script is ready, WebLOAD can execute it in the standard way it executes any Java code.

First, bind WebLOAD JavaScript context to the Java.

WebLOAD Selenium

Second, instantiate Selenium Java Object and execute its methods.

WebLOAD Selenium

 

Now this WebLOAD script can run and have it execute the Selenium script.

 

Learn more how to execute Selenium scripts in WebLOAD, schedule a DEMO with us.

 

 

47 More articles by RadView