gradle, testng project in leanft in Java

To create a LeanFT project with Gradle and TestNG, follow below steps. First of all, create a sample Gradle project in IntelliJ IDEA. Then add a libs directory under root directory and copy all LeanFT library files from C:\Program Files (x86)\HP\LeanFT\SDK\Java in it. Then ensure that your build.gradle file contains below configuration.
group 'org.softpost'
version '1.0-SNAPSHOT'

apply plugin: 'java'

repositories {

dependencies {
    testCompile group: 'org.testng', name: 'testng', version: '6.9.10'
    compile fileTree(dir: 'libs', include: '*.jar')

test {
    useTestNG {
        suites 'src/test/resources/testng.xml'

After this, create a sample TestNG test class and add LeanFT test as shown in below example. Notice that you will have to initialize the LeanFT SDK before starting the tests and clean up SDK at the end of tests. After this build your project and then run the tests.
package org.softpost;

import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

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


public class SimpleLeanFTTest {

    public void beforeClass() {

    public void afterClass() {

    public void beforeMethod() {
        try {
            ModifiableSDKConfiguration config = new ModifiableSDKConfiguration();
            config.setServerAddress(new URI("ws://localhost:5095"));
        }catch (Exception ex){
            System.out.println("Exception occured " + ex.toString());

    public void afterMethod() throws Exception {

    public void test() throws GeneralLeanFtException {
        Verify.areEqual(22,22,"Verify that 22 == 22");


Complex problems, Simple Solutions