UFT Developer scripts in LoadRunner Cloud

LoadRunner Cloud supports UFT Developer, a powerful and lightweight functional testing solution.

 

System requirements

LoadRunner Cloud supports the following:

UFT DeveloperFor details, see Version compatibility.
BrowsersChrome 56

Back to top

General requirements

  • LoadRunner Cloud supports only UFT Developer Junit and Chrome test scripts.
  • You can only run UFT Developer scripts on cloud-based load generators and not on on-premises load generators.
  • Upload a UFT Developer script to LoadRunner Cloud in .zip format.

Back to top

Upload a UFT Developer script to LoadRunner Cloud

  1. Create a UFT Developer script. For details on working in UFT Developer, see the UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer frameworks are already deployed in LoadRunner Cloud. 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 UFT Developer 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.

UFT Developer 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 UFT Developer Java web code examples, see UFT Developer Java code samples in the UFT Developer help center.

Back to top