Selenium scripts in LoadRunner Cloud

LoadRunner Cloud supports Selenium, an open-source load testing framework.

Note: You can only run Selenium scripts on cloud-based load generators—not on on-premises load generators.

Preparing Selenium scripts using JUnit

Before you upload your Selenium script that uses JUnit, make sure that your environment meets these requirements:

Tool Version
Selenium See Support Matrix
Browsers

Firefox 52

Chrome 56

JUnit Version 4.12

Preparing a script for uploading

These steps describe how to prepare your Selenium script for its upload to the LoadRunner Cloud repository.

  1. Create a storm.properties file that defines an execution type and entry point.

    The file is a standard Java properties file (key/value pairs). For example:

    execution=Selenium
    runner=junit
    entrypoint=scratch.UnitTestSample
    transactions=scratch.UnitTestSample.baseTest1,scratch.UnitTestSample.baseTest2
    Key Description
    execution The execution engine type for the script.
    runner The name of the testing framework. By default, the runner is junit.
    entrypoint The entry for the testing framework. The entry point is the full class name of the Junit test entry . In the above example, it is scratch.UnitTestSample.
    transactions

    A list of transaction names, separated by commas, which are displayed on the Load tests > SLA page.

    Transaction names are in the format: <package name>.<class name>.<test method name>.

  2. Create a .zip file that contains the storm.properties file, your Selenium script (.jar) files and all other dependencies. The storm.properties file and the *.jar files must be located in the root folder of the .zip file.

    Tip: The required JUnit and Selenium frameworks are already deployed in LoadRunner Cloud. You do not need to include these frameworks in the .zip file.

Back to top

Transaction definitions - JUnit

Transactions defined in the storm.properties file will appear in the Load tests > SLA page.

Transactions are defined in the JUnit test framework and transaction names are in the format: <test class full name>.<test method>.

In addition, all tests in your Selenium script will be reported as transactions. During a test run, add Transaction measurements for these transactions from the gallery to the dashboard to display real time data detailing the results of your load test.

Transaction names example:

Transactions are: “scratch.UnitTestSample.baseTest1” and “scratch.UnitTestSample.baseTest2”

transactions=scratch.UnitTestSample.baseTest1,scratch.UnitTestSample.baseTest2

JUnit Test java class example:

package scratch;

import org.junit.Test;

public class UnitTestSample {
      @Test
      public void baseTest1() {
          // The test method
      }

      @Test
      public void baseTest2() {
          // The test method
     }
}

Back to top

Preparing Selenium scripts using Mocha

Before you upload your Selenium script that uses JUnit, make sure that your environment meets these requirements:

Tool Version
Selenium See Support Matrix
Browsers

Firefox 52

Chrome 56

Mocha Version 5.2.0
Selenium WebDriver Version 3.3.0

Preparing a script for uploading

These steps describe how to prepare your Selenium script for its upload to the LoadRunner Cloud repository.

  1. Create a storm.json file that defines an execution type and transactions. For example:

    {
        "execution": "Selenium",
        "runner": "mocha",
        "transactions": ["sample - test item 1", "sample - test item 2"]
    }
    
  2. Create an npm package that contains the storm.json file. For details on creating an npm package, see https://docs.npmjs.com/cli/pack.

  3. Upload the npm package (which is a .tgz file ) to LoadRunner Cloud.

    Tip: The required Mocha and Selenium frameworks are already deployed in LoadRunner Cloud. You do not need to include these frameworks in the .tgz file.

Back to top

Transaction definitions - Mocha

Transactions defined in the storm.json file will appear in the Load tests > SLA page.

Transactions are defined in the Mocha test framework and transaction names are in the format: <test suite name>-<test item name>.

The example below includes one transaction called sample - test item:

describe('sample', function() {
     it('test item', function(done) {
        const driver = new Builder().forBrowser('chrome').build();
        setTimeout(() => {
            driver.get('https://software.microfocus.com');
            driver.quit();
            done();
         }, 1000);
     });
});

Back to top