LeanFT scripts in LoadRunner Cloud

LoadRunner Cloud supports Lean Functional Testing (LeanFT) scripts, a powerful and lightweight functional testing solution.

 

System requirements

LoadRunner Cloud supports the following:

Back to top

General requirements

Before you upload your Lean Functional Testing (LeanFT) script, make sure that your environment meets these requirements:

LeanFTFor details, see Support matrix.
BrowsersChrome 56

The following guidelines apply:

  • LoadRunner Cloud supports only LeanFT Junit and Chrome test scripts.
  • You can only run LeanFT scripts on cloud-based load generators, but not on on-premises load generators.
  • You must upload a LeanFT script to LoadRunner Cloud in .zip format.

Back to top

Prepare a LeanFT script for uploading

This section describes how to prepare your LeanFT script for uploading.

  1. Create a LeanFTscript. For details, see the Lean Functional Testing Help Center.

    Tip: You can optionally disable the following settings in the Resources/leanft.properties file as they are not used by LoadRunner Cloud. To disable the settings, uncomment them and change the value to false.

    • autoLaunch=false
    • reportEnabled=false
  2. Export your LeanFT project to a .jar file.
  3. 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=LeanFT
    runner=junit
    entrypoint=scratch.UnitTestSample
    transactions=scratch.UnitTestSample.baseTest1,scratch.UnitTestSample.baseTest2
    KeyDescription
    executionThe execution engine type for the script.
    runnerThe name of the testing framework. By default, the runner is junit.
    entrypointThe 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>.

  4. Create a .zip file that contains the storm.properties file, your LeanFT 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 LeanFT frameworks are already deployed in LoadRunner Cloud. You do not need to include these frameworks in the .zip file.

Once you are have prepared your zip archive file, you can upload it to LoadRunner Cloud as you would any script. For details, see Scripts.

Back to top

Transaction definitions

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 LeanFT 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.

LeanFT JUnit test example

The transaction is: “com.company.LeanFtTest.test”

package com.company;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.hp.lft.sdk.*;
import com.hp.lft.sdk.web.*;

import unittesting.*;

public class UFTDeveloperTest extends UnitTestClassBase {
    @Test
    public void test() throws GeneralLeanFtException {

        //Launch the Chrome browser.
        Browser browser = BrowserFactory.launch(BrowserType.CHROME);

        // Use try-catch to add a warning to the run report if the assert validation fails.
        try {
            // Navigate to the Advantage Online Shopping website.
            browser.navigate("https://advantageonlineshopping.com/");

            // Click the "Laptops" link (in the bottom-left corner of the page).

          browser.describe(Link.class, new LinkDescription.Builder()
                    .tagName("DIV")
                    .innerText("LAPTOPS Shop Now ").build()).click();

            // Wait for the browser to complete the navigation.
            browser.sync();

            // Verify that the correct Web page opens.
            assertEquals("https://advantageonlineshopping.com/#/category/Laptops/1", browser.getURL());
        } catch(AssertionError e) {
            throw e;
        } finally {
            // Close the browser
               browser.close();
        }
    }
    
    public UFTDeveloperTest() {
        //Change this constructor to private if you supply your own public constructor
    }

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        instance = new UFTDeveloperTest();
        globalSetup(UFTDeveloperTest.class);
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
        globalTearDown();
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

}

For more LeanFT Java web code examples, see LeanFT Java code samples in the LeanFT Help Center.

Back to top