1. Click here to download and Install LeanFT
  2. Create LeanFT Cucumber Project Go to File -> New -> Other -> LeanFT Folder -> LeanFT Cucumber Project -> Next -> Enter Group Id and Artifact Id -> click Finish.
  3. Update POM.xml with the Required LeanFT Dependencies
    <dependency>
     <groupId>io.cucumber</groupId>
     <artifactId>cucumber-java8</artifactId>
     <version>4.2.0</version>
    </dependency>
    <dependency>
     <groupId>io.cucumber</groupId>
     <artifactId>cucumber-junit</artifactId>
     <version>4.2.0</version>
    </dependency>
    <dependency>
     <groupId>io.cucumber</groupId>
     <artifactId>cucumber-picocontainer</artifactId>
     <version>4.2.0</version>
    </dependency>
    <dependency>
     <groupId>io.cucumber</groupId>
     <artifactId>cucumber-core</artifactId>
     <version>4.2.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
    <dependency>
        <groupId>com.hp.lft</groupId>
        <artifactId>com.hp.lft.sdk</artifactId>
        <version>12.53.0</version>
    </dependency>   
    <dependency>
        <groupId>com.hp.lft</groupId>
        <artifactId>com.hp.lft.report</artifactId>
        <version>12.53.0</version>
    </dependency>
    <dependency>
        <groupId>com.hp.lft</groupId>
        <artifactId>com.hp.lft.unittesting</artifactId>
        <version>12.53.0</version>
    </dependency>
    <dependency>
        <groupId>com.hp.lft</groupId>
        <artifactId>com.hp.lft.verifications</artifactId>
        <version>12.53.0</version>
    </dependency>
    
  4. Create Sample feature file LoginTest.feature
    Feature: Login Test
     @login 
     Scenario: Successful Login with Valid Credentials
      Given User is on Home Page
      When User Navigate to Test Page
      And User enters UserName and Password
      Then Verify Login Successful message
    
  5. Create step definition file
    package com.selcukes.steps;
    
    import java.util.concurrent.TimeUnit;
    
    import org.junit.Assert;
    import java.io.IOException;
    import com.hp.lft.report.ReportException;
    import com.hp.lft.sdk.GeneralLeanFtException;
    import com.hp.lft.sdk.TestObjectDescriber;
    import com.hp.lft.sdk.web.Browser;
    import com.hp.lft.sdk.web.BrowserFactory;
    import com.hp.lft.sdk.web.BrowserType;
    import com.hp.lft.sdk.web.EditField;
    import com.hp.lft.sdk.web.EditFieldDescription;
    import com.hp.lft.sdk.web.Image;
    import com.hp.lft.sdk.web.ImageDescription;
    import com.hp.lft.verifications.Verify;
    
    import cucumber.api.java8.En;
    
    
    public class LoginStepdefs implements En
    {
        
        Browser browser;
        public LoginStepdefs()
        {
         Given("^User is on Home Page$", () -> {
          browser = BrowserFactory.launch(BrowserType.CHROME);   
             browser.navigate("http://techyworks.blogspot.in/");
                
                String strPageTitle = browser.getTitle();
                System.out.println("Page Title:" + strPageTitle);
         });
    
         When("^User Navigate to Test Page$", () -> {
          driver.findElement(By.xpath("//*[@href='/p/test.html']")).click();
             
         });
    
         When("^User enters UserName and Password$", () -> {
          EditField username = browser.describe(EditField.class, new EditFieldDescription.Builder()
               .type("text").name("userName").build());
           username.setValue(un);
           EditField password = browser.describe(EditField.class, new EditFieldDescription.Builder()
           .type("password").name("password").build());
           password.setValue(psd);
           browser.describe(Image.class, new ImageDescription.Builder()
                .alt("login").type(com.hp.lft.sdk.web.ImageType.BUTTON).tagName("INPUT").build()).click();
             
             
         });
    
         Then("^Verify Login Successful message$", () -> {
          Verify.areEqual("Login Successful..", browser.getTitle() );      
             browser.close();
         });
        }
    }
    
  6. Create a runner class file
    package com.selcukes.runners;
    
    import cucumber.api.CucumberOptions;
    import cucumber.api.junit.Cucumber;
    import org.junit.runner.RunWith;
    import unittesting.UnitTestClassBase;
    import com.hp.lft.sdk.*;
    import com.hp.lft.verifications.*;
    @CucumberOptions(plugin = { "html:target/cucumber-results/cucumber-html-report",
      "json:target/cucumber-results/cucumber.json",
      "usage:target/cucumber-results/cucumber-usage.json" }, 
             monochrome = true, features = "src/test/resources/features/", glue = {
        "com.selcukes.steps" }, tags = { "@login" })
    @RunWith(Cucumber.class)
    public class LeanFTLoginTestRunner extends UnitTestClassBase{
    @BeforeClass
        public static void setUpBeforeClass() throws Exception { 
            instance = new LeanFTLoginTestRunner();       
            globalSetup(LeanFTLoginTestRunner.class);
        }
        @AfterClass
        public static void tearDownAfterClass() throws Exception {
            globalTearDown();
        }
    }