LeanFT scripts in StormRunner Load

StormRunner Load supports LeanFT, a powerful and lightweight functional testing solution.

 

System requirements

StormRunner Load supports the following:

LeanFTVersion 14
BrowsersChrome 56

Back to top

General requirements

  • StormRunner Load supports only LeanFT Junit and Chrome test scripts.
  • You can only run LeanFT scripts on cloud based load generators and not on on-premises load generators.
  • Upload a LeanFT script to StormRunner Load in .zip format.

Back to top

Upload a LeanFT script to StormRunner Load

  1. Create a LeanFT script. For details on working in LeanFT, see the LeanFT Help Center.

    Tip: You can optionally disable the following settings in the Resources/leanft.properties file as they are not used by StormRunner Load. 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 StormRunner Load. You do not need to include these frameworks in the .zip file.

Back to top

Transaction definition

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 transactions widgets 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: “stormrunner.LeanFtTest.test”

package stormrunner;

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 LeanFtTest 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 New Tours website.
            browser.navigate("http://newtours.demoaut.com/");

            // Click the "Business Travel @ About.com" link (in the bottom-right corner of the page).
            browser.describe(Link.class, new LinkDescription.Builder()
                .tagName("A").innerText("Business Travel @ About.com").build()).click();

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

            // Verify that the correct Web page opens.
            assertEquals("http://businesstravel.about.com/mbody.htm?PM=78_101_T&cob=home", browser.getURL());
        } catch(AssertionError e) {
            throw e;
        } finally {
            // browser.close();
        }
    }

    public LeanFtTest() {
        //Change this constructor to private if you supply your own public constructor
    }

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        instance = new LeanFtTest();
        globalSetup(LeanFtTest.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 Web code examples in the LeanFT help center.

Back to top