How to Install LeanFT with JAVA

If you’ve stumbled upon this page, then I’m sure you’re ready to ride on to the LeanFT bandwagon ! In case you’re still having apprehensions, check out my posts:-

Why UFT needs to Go !

LeanFT – Let’s call it CleanFT !

You can set up LeanFT with Java by following the below simple steps :-

  1. Install Java(32 bit or 64 bit depending on your system) from here.
  2. Add a new system environment variable called JAVA_HOME and set its value to where you have installed java(something like – C:\Program Files\Java\jdk1.8.0_73). In case you don’t know where to set the environment variable, you need to right click on My Computer, select Properties, goto Advanced System Settings and click Environment Variables.
  3. Add Following value in PATH environment variable – %JAVA_HOME%\bin, also remove any Oracle Java values in the PATH.
  4. Download eclipse from this location and extract it into a desired folder in your file system(somedrive:\somefolder\eclipse)
  5. Install LeanFT and select Eclipse option when tool is asked. Give the above extracted path – somedrive:\somefolder\eclipse
  6. Download gson.jar from here and put it into the plugins directory of Eclipse.

Start eclipse and it should launch the LeanFT runtime engine and you should see a LeanFT menu in the Eclipse Menu bar on the top.

Would be glad to help out people facing issues while doing this.

Happy Automating!

Harshit Kohli

Tagged with: , , ,
Posted in Tutorials

DSTC 2016 Day 1 – Test Automation Contest

DSTC organized a Test Automation Contest today at Radisson Blu, Dwarka, New Delhi. It was a well conducted event with teams from multiple cities flexing their Automation muscles.

Out of 30+ teams, we at S&P Global Market Intelligence were amongst the top 7 to be selected for this contest.We were quite excited about the event (so much that we were the ones who opened the gates of the Ballroom !). With all guns blazing, we started our quest to show our mettle.

It began with the judges explaining about the parameters on which we will be evaluated(like code quality, tool usage, team collaboration etc) and we were given some scenarios related to Google Search and GMail to be automated. What seemed to be a stroll in the park initially became a roller-coaster ride with lot of brainstorming, collaboration, code breakages, integration, network issues and what not !

After 2 hours of coding and a sumptuous lunch, all teams were ready to showcase their work. Still not out of steam, we decided to go in first. Here are some of the highlights of what the teams presented(in order):-

  1. S&P Global Market Intelligence (Gurgaon) – We showcased end to end running Java + Selenium code which was triggered from a localized setup of Jenkins. The given tasks were automated by parameterizing and data driving our tests. Framework features like Multi-threading, Cross Browser/Platform compatibility, Page Object Model, Dependency Management through Maven were showcased. We were quite surprised with the eye for detail that judges had and got some great inputs from them which we would like to work upon.
  2. Perficient (Nagpur) – This team showed a Behavior Driven approach to solving the given problem using Selenium, Java, Cucumber, ANT and Maven. I liked the overall presentation by them as BDD is one quintessential part of Agile and their framework seemed to be a robust one. Although the judges said that the given problem is not a good candidate for Agile, I was still hopeful that they might be one of the contenders for the title but the nail in the coffin was that their code was not able to execute.
  3.  Tech Mahindra (Hyderabad) – This was a team which had experience on their side(most of them being 15+ years experienced). Inspite of the judges saying that QTP is a silly tool, this team was quite enthusiastic about QTP and I think for the given problem at hand, QTP was not that bad a tool choice. They had a good UFT based framework which also had support for Mobile apps. There were some heated discussions on some of the approaches used by them on which I think I’m with the team and not the judges:)
  4.  Tavant Technologies (Noida) – People from Tavant wooed the judges with their almost too good to be true framework which was called FUSEM(Framework for Unified Scripting and Execution of MoWeb Apps). This was a Framework which was based in a Web App as well as Mobile App and users could use both entry points to create Features, Run scripts, Reporting etc. I think they stole the show as far as framework was related but I would have liked to see some technical expertise from them rather than Framework being the center point of their presentation.
  5. Aurigo Technologies (Bangalore) – 2 guys casually walked to the room and showed a simple yet powerful C#, NUnit and Selenium based framework. They seemed to have got the checklist right in terms of all the best practices of Automation but I think being just 2 in the team was a disadvantage to them as they were not able to complete even one task fully.
  6. Info Edge (Noida) – These people from Noida showcased a stellar Page Object Model based framework which used Excel to store the test cases and TestNG for running them. They were good with the coding conventions and displayed how we can run the cases from the command line. Overall, it was a good show by this team.
  7. MindFire Solutions (Bhubaneshwar) – This team had an Excel centric Framework which used Gradle for build automation and had some fancy features like creation of Video, Saucelabs integration, Jenkins compatibility etc. They were advocates of the fact that we need to simplify things for Manual QA to adopt automation but their approach of having so many excel files for different things was a let-down for me as I thought its actually making the process more complex.

Some of the key takeaways from all the awesome things I heard the whole day are:-

  1. Page Objects are a great way of maintaining your code.
  2. Naming conventions are extremely important for code quality.
  3. Stay away from hard coded waits as often as possible.
  4. BDD is great but it is not necessary that it fits the requirements of all projects.
  5. Compatibility with a build tool like Jenkins is a must have for an Automation Framework.
  6. Try to move away from Excel based frameworks as they make Continuous Integration a bit difficult.
  7. Use implicit and explicit waits judiciously as a combination of them can be harmful to the script.
  8. Try to have your identifiers/locators in an external file so that you don’t need to build your code if there are any changes to the application.

Edit: Info Edge won the competition.

Happy Automating,

Harshit Kohli

Tagged with: , , , , , , , , , , , , , , ,
Posted in Conferences

Why UFT Needs to Go !

I have finally made up my mind to try to stay away from UFT. I don’t think HP has done justice to QTP after introducing UFT.

I clearly remember the first time UFT was launched in 2012, I was like – “Wowww ! It’s a great effort by HP. There are some stability issues that I’m sure will be fixed as the tool matures”.

In 2015, I was like – “Oh myyy ! UFT is still in same shape. Let me move my Web based tests to Selenium.”

Now in 2016, when I need to run my older scripts in UFT, I’m like – “I think I need to move my Desktop based scripts to LeanFT”.

In case you haven’t worked with UFT or you can’t relate to what I’m saying, here are a list of things I have been facing with UFT:-

  1. Debugging – I place a breakpoint in my code, while pressing F10 and going to consecutive lines, UFT goes into a state of TRANCE and I need to restart it and repeat the same process (and hope it doesn’t happen this time).
  2. Error Handling – In the name of Error Handling, all we have is “On Error Resume Next”. Time to move on to try catch !
  3. Latency Issue – I sometimes can’t type in the UFT IDE coz its just so slow. I have to write in a text editor and paste in UFT IDE.
  4. Watch Window – The Dreaded HRESULT E_Fail error comes up when I try to look up something in the Watch Window.
  5. Automation Object Model – Following statement – Set objQTP = CreateObject(“QuickTest.Application”) takes atleast 10 times more time with UFT as compared to QTP.

These are only some of the issues that I have personally encountered. Apart from the above, freezing/crashing is quite frequent and performance is very slow in comparison to QTP 11.

In a nutshell, I think Selenium is awesome if you want to automate JUST web based applications but if you want the whole package of Automating Web as well as Desktop applications and use modern programming languages like C# and Java instead of VBScript, go for LeanFT ! For learning more about it, you can refer my short tutorial.

I don’t feel happy saying this, but RIP UFT😦



Disclaimer – This is just my personal opinion and you should weigh all PROS/CONS while moving to any tool.

Happy Automating!

Harshit Kohli



Tagged with: , , , , , , , ,
Posted in Common Issues

LeanFT Training Programme

For existing UFT/QTP resources, LeanFT is the need of the hour ! Here is why :-

  1. It gives you a better IDE – Visual Studio/Eclipse.
  2. It is faster in development as well as execution.
  3. It offers easier cross browser integration.
  4. It supports third party libraries as well as Frameworks.
  5. You can write more robust code (better exception handling).
  6. You can be more close to Developer’s Ecosystem – same IDE, Version Control and Testing Frameworks.

We have a comprehensive LeanFT training plan for individuals as well as corporates which can help you get kick-started with LeanFT within a few days. For more details, drop an email to –


Happy Automating !

Harshit Kohli

Tagged with: , , , , ,
Posted in Tutorials

2015 in review

The stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 26,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 10 sold-out performances for that many people to see it.

Click here to see the complete report.

Posted in Awesum Stuff

Headless Automation using C#, PhantomJS and NUnit

Although the name “Headless” might sound a bit scary, but Headless Browser Automation is a great way of creating lightweight tests that quickly send you results without the burden of actually opening a physical browser. So basically this way, we navigate to a website but save on the rendering time which may be beneficial in some scenarios like Continuous Integration where we want to have quick results and is more convenient to run from the command line(or a BAT file).

We can Launch multiple instances of the the script which can help in reducing the time significantly. So here is how we can leverage Headless Automation in C#:-

*Please note that I have taken NUnit Test Framework for the sake of simplicity of execution and this is optional.

  1. Create a New Project in Visual Studio and from the Templates, select Visual C# -> Windows Desktop -> Class Library.
  2. Install NUnit from here and add a reference to the following DLL in your project – “C:\Program Files (x86)\\framework\3.0.5813.39031\net-4.0\nunit.framework.dll” (this path may change depending on your version and the path where you install NUnit)
  3. Download Selenium Libraries from here and add reference to following DLLs in your Project(this would be present where you download selenium\selenium-dotnet-2.48.0\net40 :-
    1. Selenium.WebDriverBackedSelenium.dll
    2. ThoughtWorks.Selenium.Core.dll
    3. WebDriver.dll
    4. WebDriver.Support.dll
  4. You will also need the phantomjs.exe from here. You need to add this to the bin\Debug folder in your project.
  5. In Order to capture snapshots(yes, this is possible for Headless Browsers also !), you need to add a reference to System.Drawing from the default assemblies available.
  6. In Order to run the Nunit Tests from the Visual Studio GUI, you need to goto Tools-> Extensions and Updates->Online and search for NUnit3 Test Adapter. Install this extension and restart Visual Studio.
  7. For Nunit Fundamentals, you can refer this link.

Now you are fully loaded and ready to go with this. Following is a sample code:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing.Imaging;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.PhantomJS;
using OpenQA.Selenium.Remote;

namespace NUnitPhantom2
 //TestFixture indicates that this class contains Test Methods
 public class TestClass
 //Declaring the PhantomJS Driver
 PhantomJSDriver phantom;
 //OneTimeSetUp attribute defines that the following method will run once the class is instantiated, i.e. once in the start of the run
 public void classSetup()
 //Creating the instance of the PhantomJS driver
 phantom = new PhantomJSDriver();
 //Setting the default timeout to 30 seconds
 phantom.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 30));

 //SetUp attribute defines that the following method will run before each method runs.
 public void Test_Setup()


 //Test attribute defines that the following is a Test Method
 public void Test_Phantom1()
 //Navigate to Bing

 //Search for Learn2Automate

 //Click on Search

 //Grab the Snapshot
 Screenshot sh = phantom.GetScreenshot(); 
 sh.SaveAsFile(@"C:\Temp.jpg", ImageFormat.Png); 

 //TearDown attribute defines that the following method will run after each method runs.
 public void Test_CleanUp()


 //OneTimeTearDown attribute defines that the following method will run once the methods in the class have run, i.e. once in the end of the run
 public void classTearDown()
 //Close the PhantomJS instance

This is how this would look in Visual Studio:-



I hope the comments in the script are self explanatory. You can comment below if you have any queries.

Happy (Headless) Automating !

Harshit Kohli



Tagged with: , , ,
Posted in Awesum Stuff

LeanFT C# Tutorial Part 9 – Using LeanFT and Selenium Together !

I don’t want to debate which tool is better, of course both tools have their advantages and disadvantages. So lets use all the advantages together in a mega script which uses both technologies. For doing this, you have to:-

  1. Create a LeanFT Test Project in Visual Studio.
  2. Download Selenium Libraries from here.
  3. From the downloaded folder, add the reference for the following DLLs your Visual Studio project:-
    1. Selenium.WebDriverBackedSelenium.dll
    2. ThoughtWorks.Selenium.Core.dll
    3. WebDriver.dll
    4. WebDriver.Support.dll
  4. If you are working with Chrome, you need to additionally download the chromedriver.exe from here and put it in the bin\debug folder.
  5. Now the setup is done, you can get your hands dirty with the following code:-

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HP.LFT.SDK;
using HP.LFT.SDK.Web;
using HP.LFT.SDK.Insight;
using System.Drawing;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System.IO;

namespace LeanFtTestProject1
    public class LeanFtTest : UnitTestClassBase<LeanFtTest>
        IBrowser browser;
        IWebDriver chromeDriver;

        public static void ClassInitialize(TestContext context)

        public void TestInitialize()
            //browser = BrowserFactory.Launch(BrowserType.Chrome);
            ChromeOptions CO = new ChromeOptions();
            CO.AddExtension(@"C:\Program Files (x86)\HP\LeanFT\Installations\Chrome\Agent.crx");
            chromeDriver = new ChromeDriver(CO);
            browser = BrowserFactory.Attach(new BrowserDescription
                Type = BrowserType.Chrome

You can now use chromeDriver and browser objects interchangeably in your script!

For more information on using Selenium in C#, you can refer many blogs that write about it.

Happy Automating!
Harshit Kohli

Tagged with: , , , , , ,
Posted in Tutorials
Blog Stats
  • 96,432 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 710 other followers


Get every new post delivered to your Inbox.

Join 710 other followers

%d bloggers like this: