0 Shares 1147 Views

LeanFT Tutorial #5: Create Tests in LeanFT

Sep 25, 2017
Create Tests in LeanFT

In this post of LeanFT/UFT Pro tutorial series, we will go through steps to create tests in LeanFT and learn about IDE project templates and prerequisites. As mentioned in earlier posts, we are using IntelliJ and Java for this tutorial. Let us know your experiences and issues (if any) with any other tools, in the comments section.

Create Tests in LeanFT

LeanFT works with different IDEs of your choice such as Visual Studio, IntelliJ, Eclipse. LeanFT provides plugins for these IDEs to get along with different options and settings. Refer our earlier post on Getting Ready with LeanFT for more details on setting up LeanFT for different IDEs. LeanFT plugin comes with built-in project templates to provide initial structure for your project and basic initial references.

Project Template for IntelliJ

You can create a Selenium based project or a Maven based project. If you want to create Selenium based project, LeanFt provides LeanFT for Selenium, a solutions which extends the Selenium APIand enables to create more robust and easily maintainable Selenium tests.

To start with a Maven based project, you should install LeanFT JARs to the Maven Repository local or to your organization’s repository. You can do this easily by running the commands below


Organization’s Repo

Now we need to create the test from IDE, since we are using IntelliJ, go to menu Option “File> New Project”. Follow the wizard

Select Testing Framework and SDK, check create a maven project option if you want to create maven based project.

Select Selenium if you want to use Selenium based project. You will need to select the JAR file from LeanFT installation folder.

Follow the rest of wizard.

Automate a Web Application

Once you have the basic or initial project template you can start writing your test. Alternatively you can also have your custom framework and project template. You can also use Test Recorder to accelerate your test creation.

Since you have the base project created, as described in previous section. Lets now write our scripts for the test. The most important method in the LeanFTTest Class created above is the “test” method. Since we have created our project as LeanFT SDK, SDK libraries will automatically gets included into the project. In case of Selenium, all the relevant libraries gets included.

Since we are going to automate a web application, we will need to import relevant package to work with web applications. Lets import the leanFT web Package. Add the statement below to the import section at top.

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

Now will write the code to launch the browser in our test method. You can change the method name to some meaningful name of your choice based on your test.

 The first thing you need to do while automating a web application is to decide which browser you are going to use and then launch. It will depend on various factors like application compatibility, feature/behavior to test etc.

Note that Browser must be configured appropriately to work with LeanFT. Refer our post on Browser Extensions and Settings

In this example we are going to use Chrome browser and will navigate to new tours website. We will use BrowserFactory Method to do this.

Now we can extend our test to include more tests and operations to AUT. We have already seen Object Identification Center and Application model to include test objects in test project. Using these we can now perform different operations as required.

When you defined the browser here, it becomes the top level parent object and now you go down to the hierarchy of objects and create test object as child of the relevant parent object. Use OIC to determine different set of properties to describe your object.

Use Describe method to create the child object.

For example

Run your LeanFT Test

Simply right click on your test method and select Run Test Method option

To run the test using Maven:

To run your tests locally, you compile your project, and then use either your testing framework’s runner, such as NUnit or JUnit, to run your compiled .dll or .jar, or any other relevant runner.

Step 1: In your project’s pom.xml file, Create a property for the test source directory:




Under the build tag, add:


Create a LeanFT profile:









Step 2: Run mvn test –P leanft-test.

Run Results

When you run LeanFT tests created from a LeanFT project template, an HTML report is automatically generated. The report includes summary information about the run as well as detailed information about the captured steps.

To View the result, goto menu Option “LenFT> View Last Run Results”

You may be interested

Setting up Web Service Automation Project
Katalon Studio
Katalon Studio

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
611 views1
Katalon Studio
611 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…

UFT Jenkins Integration
Unified Functional Testing
Unified Functional Testing

UFT Jenkins Integration

Saket - Oct 03, 2017

In our earlier post, we got to know the easy integration of UFT with GIT. This post focuses on integration of UFT and Jenkins. I have also…

Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Email Address
Secure and Spam free...