LeanFT — Setup, Develop & Execute

It’s all about Shifting left

Introduction

It is definitely not a better version of UFT as many assume so, rather, it is a better version of Selenium. You can test the desktop applications in java using an open-source IDE. LeanFT or UFT developer is curated to address all the limitations Selenium had but to do that it had to bring some complexity that might pose as a fear to UFT testers.

For a UFT user, it is necessary to learn Java or C# and become familiar with the IDE like Eclipse, IntelliJ, or Visual Studio. For a Selenium user, it is a piece of cake.

The value it adds to an organization is commendable :

Selenium resources are easily available, Finding a good UFT tester who would be keen on going into the complexity of integration is harder.

A developer can use the same IDE where he writes his code and can use the UFT Developer plugin to test his code, integrate his test suite in the pipeline and make a seamless deployment.

Setup:

To download and install UFT Developer, we need to follow the steps listed below

Pre-requisites

Node js

— download from here latest & install

JDK & Eclipse

— download from here & install

Note: if you want to use App Model you should install JDK1.8 and an eclipse version that works for java 1.8

Maven

— download from here & install

Step 1: Download the trial version

Create your account and download the available trial version.

Download Link:

Make sure you use the path as the path where your IDE is located

upon successful installation, you should be able to see the UFT Developer plugin in your IDE toolbar Menu.

Note: This license is machine based, if you have already downloaded other software of MicroFocus and used any license on the same machine, Trial license will not work for you

Develop:

In case you find the tools not enabled please bring the runtime engine up.

Once you run it, the Runtime engine will start and the Notification panel will show it as active, Usually, the Runtime engine activates itself as soon as the IDE is launched where it is plugged in but after a certain idle time, it goes automatically deactivated.

Object Identification Center (OIC)

To identify an object, you need to set the add-ins in your runtime engine Settings option

Make sure you have the desktop and browser resolution set to 100%, once the resolution is set, click on the OIC button in the toolbar, this will open the OIC

Create an APP model add objects in your App Model using the spy inside the App Model. See the SDK auto-generated as a java file with the same name as the App Model.

Add Object in App Model

For maven dependencies please follow the instruction mentioned here

Ensure that you have these four dependencies added to your POM successfully.

<dependency>
<groupId>com.hp.lft</groupId>
<artifactId>com.hp.lft.sdk</artifactId>
<version>{version}</version>
</dependency>
<dependency>
<groupId>com.hp.lft</groupId>
<artifactId>com.hp.lft.report</artifactId>
<version>{version}</version>
</dependency>
<dependency>
<groupId>com.hp.lft</groupId>
<artifactId>com.hp.lft.unittesting</artifactId>
<version>{version}</version>
</dependency>
<dependency>
<groupId>com.hp.lft</groupId>
<artifactId>com.hp.lft.verifications</artifactId>
<version>{version}</version></dependency>

Create an Application Model and add the object to test

Check these videos for more details on how to capture the objects and store them in App Model

Write a sample script to get started :

package unittesting;import java.awt.Point;import java.net.URISyntaxException;import org.junit.Test;import com.hp.lft.report.ReportException;import com.hp.lft.report.Reporter;import com.hp.lft.sdk.GeneralLeanFtException;import com.hp.lft.sdk.ModifiableSDKConfiguration;import com.hp.lft.sdk.Mouse;import com.hp.lft.sdk.MouseButton;import com.hp.lft.sdk.SDK;import com.hp.lft.sdk.web.Browser;import com.hp.lft.sdk.web.BrowserFactory;import com.hp.lft.sdk.web.BrowserType;import sample.sample;public class samplTest {Browser browser;sample sam;static {System.out.println("before");ModifiableSDKConfiguration config;try {config = new ModifiableSDKConfiguration();try {SDK.init(config);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}} catch (URISyntaxException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}//SDK.cleanup();System.out.println("after");}@Testpublic void sampleBrowserLaunch() {try {browser = BrowserFactory.launch(BrowserType.CHROME);browser.sync();browser.navigate("http://google.com");sam = new sample(browser);if(sam.GooglePage().exists())System.out.println("Google page visible");Reporter.reportEvent("Passed", "Google page visible");if(sam.GooglePage().SearchEditField().exists())sam.GooglePage().SearchEditField().setValue("LeanFT");Thread.sleep(2000);if(sam.GooglePage().GoogleSearchButton().exists())sam.GooglePage().GoogleSearchButton().click();Thread.sleep(3000);if(sam.LeanftGoogleSearchPage().AllWebElement().exists())Reporter.reportEvent("Passed", "Validation all Tab Successfully!");elseReporter.reportEvent("Failed", "Validation all Tab Failed!");}catch (ReportException e){e.printStackTrace();}catch (GeneralLeanFtException e){e.printStackTrace();}catch (InterruptedException e){e.printStackTrace();}}}

Infrastructure :

Because it has a stand-alone version available, you can easily execute your test cases on dockers or VMs without installing the entire plugin.

It has a provision of Grid as well for parallel testing.

Happy learning…:)

A learner for life