I. Introduction and Purpose

The introduction of Hewlett Packard Enterprise (HPE) LeanFT with UFT 12.50 enabled users to create tests in popular development IDE’s such as Visual Studio and Eclipse. Using these IDE’s, automated tests can be written in Java or C# .Net and used within continuous integration and deployment frameworks. With the release of LeanFT 12.52, HPE introduced a JavaScript SDK. Tests can now be written in JavaScript as well.

HPE has instructions on how to install and implement the JavaScript SDK at this page: http://leanft-help.saas.hpe.com/en/12.54/HelpCenter/Content/HowTo/JS-Basic.htm. However, their instructions can be somewhat confusing. The purpose of this article is to summarize the instructions and give step-by-step directions to install the SDK. There are several detailed steps to install and configure the JavaScript SDK. These steps vary depending on the version of LeanFT that is installed and whether or not it was installed stand-alone or as part of a UFT installation.

HPE instructions state that you must install the JavaScript SDK as a Node.js module. When you installed LeanFT, you should have installed Node.js. If you have not, see the detailed instructions to install LeanFT here:


HPE’s instructions to install the JavaScript SDK link to external sites for installing Mocha and Jasmine, and those sites link to other sites with additional instructions and suggestions. This can get confusing, so the goal of this article is to give you step by step instructions for installing the JavaScript SDK from LeanFT 12.54 without having to jump from link to link. I have provided the links for reference, but everything you need to do is in this article.

II. Create Test Project Folder

The first step to install the SDK is to create a folder where your JavaScript tests will be stored. For example purposes, I created mine at c:\LeanFT_JS_SDK. This folder is where you’ll install the JavaScript SDK, your JavaScript Framework, and store the tests.

III. Install Mocha or Jasmine

The next step is confusing if you have not worked with JavaScript before. It mentions the Jasmine and Mocha frameworks. If you already use one of these frameworks, great. If not, I would recommend the Mocha framework. For these instructions I’ll primarily be using Mocha, but I include how to install and use Jasmine too.

The instructions to install Mocha can be found at https://mochajs.org/. If you choose to use Jasmine, you can find instructions for it here https://www.npmjs.com/package/jasmine. You do not need to follow the instructions on these sites, as I have included required steps below.

Now, to make things even more confusing, both the Mocha and Jasmine instructions are written with Linux file systems in mind. You can finish the procedure using MS DOS commands, but if you want to, you can install Cygwin.

A. Try Using Cygwin

Cygwin, in a nutshell, enables you to run commands as if on a Linux system. You can download and install it from here: http://cygwin.com/install.html. Detailed setup instructions can be found here (https://cygwin.com/cygwin-ug-net/setup-net.html).

I recommend the following steps:

  1. Choose Install from Internet
  2. Choose c:\cygwin for the Root Directory
  3. Choose whatever you want for the Local Package Directory. I used c:\cygwin as well.
  4. When choosing a download site, any will do. Choose one close to you for best speeds.
  5. Be sure expand the ‘Devel’ category and enter ‘make’ in the Search field. Choose to install ‘make’ at a minimum. You can leave everything else as default.
  6. Allow it to install any dependencies.
  7. After install is complete, launch Cygwin so it will create the user folder.

In Cygwin, you need to alias the make command to Cygwin’s make.exe file. To do this, open a Windows File Explorer and navigate to the location you installed Cygwin (I put mine in c:\cygwin, and for simplicity’s sake I suggest you do as well) and drill down to the user’s home folder. Mine is C:\cygwin\home\Administrator. In this folder you will find a .bashrc file. Open this file in your favorite text editor and scroll all the way to the bottom. Add the following code:

Note that if you installed Cygwin in a different location than c:\cygwin, you will have to adjust the path to point to the correct location. Shut down and restart Cygwin to put this change into effect.

B. JavaScript Test Framework

Install a JavaScript test framework (Mocha, Jasmine, etc.). You can install both if you like. They can coexist.

C. Installing Mocha

For the purpose of this example I will give you step by step instructions for the MINIMUM steps needed to install Mocha. For detailed instructions regarding installing and using Mocha, please see https://mochajs.org/#installation. There you will find links to additional information and help for Mocha.

To install Mocha, launch a Windows, Cygwin or Node.js command window (I recommend Cygwin), navigate to the folder you created earlier (c:\LeanFT_JS_SDK) and run the command:

Next, create a test directory:

Navigate to your new test directory, create a JavaScript file named test.js and edit it with the following code:

Back in Cygwin, in your c:\LeanFT_JS_SDK directory, run the command:

The result should look like this:

Depending on what editor you use (I use Atom), you may encounter an error about “missing separators”. This is due to the text editor not formatting white space in a compatible way with the make file. To fix this you can use an editor like Atom that formats text for specific languages. Notepad ++ is also a good one, but you have to change some settings to get it to work correctly. You can see those instructions here (http://altamodatech.com/blogs/?p=452).

D. Installing Jasmine

As noted, you can use Mocha or Jasmine. If you choose Jasmine, for the purpose of this example I will give you step by step instructions for the MINIMUM steps needed to install Jasmine. For detailed instructions regarding installing and using Jasmine, please see https://www.npmjs.com/package/jasmine

In Cygwin, from the c:\LeanFT_JS_SDK directory, run the following code:

IV. Install LeanFT JavaScript SDK

Open a Windows command window in the c:\LeanFT_JS_SDK folder and run the below command (including the quotes “, the space and the period . at the end):

Note that a LeanFT Standalone install location will be different from a UFT/LeanFT Install Location, so adjust as necessary. Also note that in the event you installed on a 32 bit machine, the path will begin C:\Program Files\ instead of C:\Program Files (x86)\. If you did not install in the default location, then edit for your custom location.

LeanFT Standalone: C:\Program Files (x86)\HP\LeanFT\SDK\JavaScript

UFT/LeanFT:  C:\Program Files (x86)\HP\Unified Functional Testing\SDK\JavaScript

This will install the JavaScript SDK in c:\LeanFT_JS_SDK. The result should look similar to this:

V. Running Tests

Manually launch LeanFT Runtime prior to running tests.

I’ve included a sample test below that you can copy and put in your test folder. Name it template.js.

Now, to run tests, simply ensure you are in your project folder (c:\LeanFT_JS_SDK) and enter the command


(You can use either Cygwin or Windows command window).

A. Results

Using the below template test, the results will look like this:

B. Template test

Note that this test (from http://leanft-help.saas.hpe.com/en/14.00/HelpCenter/Content/HowTo/JS-Basic.htm) launches the Chrome browser. If you do not have Chrome, alter the line

accordingly. Also note that depending on if you are using mocha or jasmine, some of the lines need to be edited for that framework. See the comments in the code




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.