Achieving functional test automation in the cloud with UFT Pro (LeanFT)

by in Application Delivery Management

(This blog was co-written with Anton Kaminsky from Micro Focus LeanFT RnD)

UFT Pro (LeanFT), is an advanced functional test automation solution that was designed specifically for continuous integration and continuous testing. It provides many powerful tools and capabilities that enable you to easily and efficiently create robust test automation in your IDE and integrate it seamlessly into your CI process. LeanFT enables automating applications of a wide range of technologies, including web and mobile applications.

Modern applications are expected to function properly on a large combination of operating systems, browser versions, mobile devices and form factors. Testing applications on any of their supported environments requires creating these environments and maintaining them, which is a lot of a hassle, takes a lot of time, and costs a lot of money.

With the launch of StormRunner Functional (SRF), our new cutting edge cloud-based testing solution, you can extend your local lab into the cloud, and execute your LeanFT tests remotely. Now you can test virtually on any type of a browser and mobile device, without investing any effort in creating the desired environments. Moreover, you can execute any LeanFT web or mobile test on different SRF-provisioned environments in parallel.  Then you can analyze the results using a unified SRF run results view that enables you to easily understand the test results for each of these environments.


Running LeanFT tests in the cloud (SRF)

SRF supports two execution modes: Remote execution and Cloud execution, both are supported by LeanFT:

Remote Execution – In this mode, run your LeanFT tests in your local lab, against SRF’s cloud environments (browsers and/or devices). In your test code you specify the capabilities of the desired environment (OS, browser type and version, device properties, resolution, etc). When executing these tests, they will run on environments allocated dynamically by SRF in the cloud (as specified in your code), rather than on your local browsers / devices.

Cloud Execution – In this mode, you work entirely in the cloud. You upload your LeanFT scripts from your local environment to SRF (or even create them in SRF directly) and run them on the SRF UI on selected environments. No local runtime environment is needed in this mode.

Let’s explore some technical explanations about running LeanFT tests in the SRF cloud in each of these modes, while focusing mainly on the remote execution mode.


Cloud execution mode

As mentioned, in Cloud Execution mode you upload your LeanFT scripts (LeanFT Java or JavaScript scripts) to SRF. Then you create automation tests in SRF, which are composed of any number of your scripts, and configure them to run on selected environments.

When uploading LeanFT scripts to SRF, you do not need to modify your code—even if it was created assuming the scripts are to be executed on your local environment. (So for instance, you can launch browsers in your code using the BrowserFactory.launch API, and lock mobile devices using the MobileLab.lockDevice API.)

When executing your uploaded scripts from StormRunner Functional, it automatically “injects” the environments selected in SRF as the execution environments into your scripts. This overrides the environments you “hard coded” in your scripts.

Because Cloud Execution enables executing the uploaded tests on any environment without modifying the code, anyone, even non-technical / business stakeholders, can easily select the desired environment(s) and execute the tests directly from the browser.

In addition to uploading your LeanFT tests to SRF, you can create them in SRF directly. You can do this simply by using SRF’s recorder. When you record your tests in SRF, it creates them as LeanFT JavaScript tests.


Remote execution mode

As described earlier, in remote execution mode you run your LeanFT tests in your local lab (from your IDE / command line / CI server), against SRF’s cloud environments (browsers / devices). In your test code you should specify the desired SRF environments’ capabilities. When executing these tests, they will run on SRF environments allocated based on the capabilities specified in your code.

Remote execution mode is supported by all LeanFT SDKs: C#, Java and JavaScript.

When working with the remote execution mode, you can debug your LeanFT tests in your IDE while using your local environment, prior to modifying them to be executed on SRF environments.

In this section, I will walk you through the process of configuring LeanFT and writing a test, which will then be executed on SRF remote environments.



To run your LeanFT tests on remote SRF environments, first setup the SRF server connection information in the LeanFT settings dialog. Let’s see how to do that.

First, log into SRF, and click the “settings” icon on the top right of the page:


Select “Integrations” in the left pane, and click “Generate New” under “Remote Access”:


In the opened dialog box enter some name, select the “execution” type and click “Generate”:


SRF generates a client ID and a Client Secret, and presents them in the following dialog:



Copy and save the values of the Client ID and Client Secret fields, and close the dialog.

Start the LeanFT Runtime engine, right-click its icon in the task bar and select “Settings”:


The LeanFT runtime settings dialog will open. In the settings dialog box, go to the Labs tab.


Under “StormRunner Functional Settings” enter the SRF server address and the client ID and Client Secret you copied. If you need a proxy to access SRF, check the “Use proxy” checkbox and enter the proxy information under the “Proxy Settings” section. You can test your connection using the Verify button. Once you have verified the connection, click on save. This will restart the LeanFT runtime.

You are now ready to execute LeanFT tests remotely on SRF!


Create / modify your test to run on SRF

LeanFT introduces a new class, named SrfLab that enables launching SRF environments (browsers / mobile devices) in the cloud. The usage of this class is very similar to usage of the BrowserFactory and MobileLab classes (used for launching/locking local browsers/devices), which enables you to easily modify your existing LeanFT scripts to be executed on SRF environments, rather than on your local environments.

The main methods included in the SrfLab class are (the following is a Java example, but these methods are available in .NET and JS SDKs as well):

public static Browser launchBrowser(BrowserType browserType)
public static Browser launchBrowser(BrowserDescription description)
public static Device lockDevice(DeviceDescription description)
public static Device lockDeviceById(String deviceId)

SrfLab also provides the following methods, which can be used to release the environment provided by SRF:

public static void releaseEnvironment(Browser browser)
public static void releaseEnvironment(Device device)

As a best practice, we recommend performing the launchBrowser\lockDevice operation in the test class’ “before” section (in the case of JUnit – the method annotated with “@Before”), and then release the environment in the class’s “after” section.

Note: Environments that are not explicitly released will be released only once the entire execution is finished.

The remote SRF environments can be configured using the new set method, introduced in LeanFT 14.01, for the BrowserDescription and DeviceDescription classes. The set method can be used to describe the capabilities of the SRF environment, for the desired Browser or Device requested from SRF. The set method can also be used to define SRF related capabilities such as the test name, build, release, tags and more.

Here is the set method’s API:

public void set(String capability, Object value)

The set method is also available through the Java SDK description builder syntax.

A full list of supported capabilities can be found here.


Here is an example for a LeanFT Java test that executes on a cloud browser provided by SRF:

public void demoTest() throws GeneralLeanFtException {
   //define the browser description and launch a browser in StormRunner Functional
   BrowserDescription description = new BrowserDescription.Builder()
             .type(BrowserType.CHROME) //use Chrome browser
             .set("version", "latest") //latest Chrome version
             .set("osType", "windows") //run on Windows
             .set("osVersion", 10) // Windows 10
             .set("testName", "LeanFT SRF Demo test") //test name as will be displayed in SRF results

   Browser browser =  SrfLab.launchBrowser(description);

   //Replace the launch with the following line if you want to run the test locally instead of SRF
   //Browser browser = BrowserFactory.launch(BrowserType.CHROME);

   //Navigate to google and search for StromRunner Functional

   EditField searchEditField = browser.describe(EditField.class, new EditFieldDescription.Builder()

   searchEditField.setValue("StormRunner Functional");

   Button searchButton = browser.describe(Button.class, new ButtonDescription.Builder()
            .name("Google Search").build());;
   //Click on the StormRunner Functional to go the SRF site
   Link linkToSrf = browser.describe(Link.class, new LinkDescription.Builder()
             .innerText("StormRunner Functional - PDP - Micro Focus").build());;

   //Make sure the link for "Add me to the List" exists
   Link addMeToListLink = browser.describe(Link.class, new LinkDescription.Builder()
             .innerText("Add me to the list")



   //releases the browser environment allocated in SRF

As you can see, once you obtain the “Browser” object (using the SrfLab.launchBrowser method), the rest of your script is exactly as if you ran your test on a local browser. This allows you to easily modify your existing tests to run in the cloud rather than locally.


When running LeanFT tests remotely on SRF, two run reports are created:

  • The regular LeanFT run report is created in your local environment and can be easily linked from your CI tool / ALM.
  • The run results are also presented in the “Results” tab in SRF itself, in a view which can be easily understood by non-technical / business stakeholders.

In the LeanFT report the following information is shown for the launch step:


Under “Browser Information” we can see that the browser was launched on StormRunner Functional, along with the full environment information.  The report offers browser type and version, OS type and version and the screen resolution. A link to the SRF report is also provided (“Show results”), allowing you to open the corresponding SRF report directly from the LeanFT report.


The corresponding SRF report looks like this:


In this report, you can see the entire flow of the executed test in terms of business operations rather than technical ones. You can drill down into each of the steps and get more useful information. In addition, the executed flow is also represented using a special screenshot-based view, which is synchronized with the step presented in the steps tree.



Starting with UFT Pro (LeanFT) 14.01, and with the launching of StormRunner Functional, you can extend your local lab into the cloud, execute your LeanFT tests on remote (cloud) environments and save the hassle of creating and maintaining your web and mobile environments locally. When using SRF’s Cloud execution mode, you can even execute LeanFT tests without having a local LeanFT runtime environment at all.

For more information refer to the LeanFT Help Center, and StormRunner Functional Help Center.



Functional Testing