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.
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.
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.
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:
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.
Explanation of Fields
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.
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.
Test Method Name
This is the test method in the Visual Studio project. I kept the name from the HPE example code, Verify_linkNavigatesToAboutTravelSite.
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.
Viewing Results in HPE ALM
Please see this post by clicking here.
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:
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.
This log file should give you an indication of what caused the failure.
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:
<nunitFrameworkPath>C:\Program Files (x86)\NUnit 2.6.4\bin</nunitFrameworkPath>
<!– <javaAssets>%CLASSPATH%;$LEANFT_INSTALL_DIR\SDK\Java/*;C:\JUnit\/*.jar</javaAssets> –>
and now in 12.53 it looks like this:
<framework version=”2.6.4″ path=”C:\Program Files (x86)\NUnit 2.6.4\bin” />
The change is with the nunit tags.