Running HPE LeanFT Tests from HPE ALM – Part Two

Tests Created in Visual Studio

With the release of HPE UFT/LeanFT 12.51, HPE provided the capability for HPE LeanFT tests to be executed from HPE ALM with the results stored in HPE ALM. We found the process to accomplish this in HPE documentation to be cumbersome, and it currently contains errors (which HPE is correcting).

I’m going to show you how to accomplish this with step-by-step instructions. This post will show how to do it with tests created in Visual Studio. This previous post shows how to do it with tests created in Eclipse. We will be using the following configuration:

HPE LeanFT 12.52

Visual Studio Professional 2013

HPE ALM 12.50 Patch 1 (Required)

NUnit 2.6.4 (version 3.2.1 has been released but is not supported at this time)

I will be referring to HPE documentation in this post. You can see the original documentation for HPE LeanFT 12.52 at the HPE LeanFT Help Center. For specific instructions to set up NUnit, refer to instructions here.

Create an NUnit Test in Visual Studio and Export the .dll File

If you haven’t already, you must first download and install a supported version of the NUnit framework from the NUnit download site.NUnit

I’m going to use some very simple code borrowed (and slightly edited) from the HPE LeanFT Help Center Web Code Examples. (Web Example: Navigate to a Web Site).

This code launches a Chrome browser, navigates to http://newtours.demoaut.com/, and then clicks the Business Travel @About.com link. It then verifies the page URL. Finally, it will close the browser.newtours2

You can download my project source code and .dll file by clicking here.

Modify Remote Agent Settings

If your remote agent is already running, you can simply right-click the icon in the taskbar and choose Settings.LeanFT 6

This will launch the LFTRemoteAgent.exe.config file in Notepad. Alternatively, you can navigate to C:\<install location>HP\LeanFT\Tools\RemoteAgent and open the file in a text editor and modify it.

Near the bottom of the file is a section, leanft, that is commented out by default. Several elements at the bottom of this section need to be uncommented and modified appropriately. For mine, it looks like this:nunitframework

The most important modification here is to the <nunitFrameworkPath> element. It must contain the full path to the NUnit /bin folder.

To use relative paths to your tests in HPE ALM settings, you can also modify the <testAssetDir> to point to the folder where your test .dll files reside.

Configure HPE ALM Settings in Test Plan

An HPE LeanFT test is somewhat different from a GUI or API test, in that it does not actually reside in HPE ALM, but rather HPE ALM points to the location where you stored the test .dll file.

First, start in the Test Plan. Create a new test with a Type of LEANFT-TEST.LeanFT 7

Explanation of Fields

Framework

This is going to be either NUnit or JUnit, depending on what IDE the test was created in. In this example, we created the test in Visual Studio, therefore we will choose NUnit.

DLL Path

This value will depend on if you entered a path in <testAssetDir> in the remote agent settings, as described above. If you did enter a value in <testAssetDir>, you are using relative paths and will simply enter the test.dll file name. If you did not enter a value in <testAssetDir>, this will be the full path to your test .dll file, including the file name.

Fully Qualified Class Name

This will be the namespace.classname of your test.testfixture

Test Method Name

This is the test method in the Visual Studio project. I kept the name from the HPE example code, Verify_linkNavigatesToAboutTravelSite.publicvoid

Set Up the Test Lab

Add your test from the Test Plan to the Test Lab like you would a GUI or API test. Click the Run or Run Test Set buttons and run it the same way you would a GUI or API test.automaticrunner

Viewing Results in HPE ALM

Please see this post by clicking here.

Troubleshooting

If you get any failures when running, you can check the run logs to see what happened and troubleshoot.

Close the Automatic Runner prior to attempting to look at the logs.

The LeanFT.log file is located in the C: drive root. Open that in a text editor. Near the bottom of the file, you will see a path that looks like this:viewercontrol

The key to look for is the “\RUN\##\RUN_##_nunit_log_##.txt” segment. Copy this path up to the \RUN folder and paste it into a File Explorer address bar. The folder with the highest number represents the latest run from HPE ALM. Open the .txt file located within.run84junitlog

This log file should give you an indication of what caused the failure.

Update

When installing HPE UFT 12.53, it replaces the LFTRemoteAgent.exe.config file located in \Tools\RemoteAgent\ with a new version. Further, HPE has changed the format of the file. In previous versions, the Remote Agent Section looked like this:

  <remoteAgent allowRun=”true”>

       <nunitFrameworkPath>C:\Program Files (x86)\NUnit 2.6.4\bin</nunitFrameworkPath>

       <testAssetDir>C:\LeanFTALM</testAssetDir>

        <javaAssets>%CLASSPATH%;$LEANFT_INSTALL_DIR\SDK\Java/*;C:\JUnit\junit-4.12.jar;C:\JUnit\hamcrest-core-1.3.jar</javaAssets>

       <!– <javaAssets>%CLASSPATH%;$LEANFT_INSTALL_DIR\SDK\Java/*;C:\JUnit\/*.jar</javaAssets> –>

     </remoteAgent>

 

and now in 12.53 it looks like this:

        <remoteAgent allowRun=”true”>  

<nunit>    

<framework version=”2.6.4″ path=”C:\Program Files (x86)\NUnit 2.6.4\bin” />  

</nunit>  

<testAssetDir>C:\LeanFTALM</testAssetDir>  

<javaAssets>%CLASSPATH%;$LEANFT_INSTALL_DIR\SDK\Java/*;C:\JUnit\junit-4.12.jar;C:\JUnit\hamcrest-core-1.3.jar</javaAssets>

</remoteAgent>

The change is with the nunit tags.

 

By Michael Deveaux

Michael has been a Technical Support Engineer with Orasi since November of 2012, focusing on supporting customers with QTP, UFT and UFT Pro (LeanFT) issues. Prior to coming on board with Orasi, Michael has over 12 years of functional testing experience utilizing WinRunner, QuickTest Professional and Unified Functional Testing.

Leave a comment