LeanFT and Eclipse

Question ID: 106306

This LeanFT stuff is all new to me and I want to get started using it with Eclipse since I work with Java. I read the little documentation that came with it and I have no clue on where to start. Does anyone know what to do to get started?

Marked as spam
Posted by (Questions: 89, Answers: 4)
Asked on August 7, 2015 12:34 pm
Answers (4)
Private answer

1) After you download and install LeanFT, don't forget to check the option for Eclipse (if you are using Java) which will install the necessary templates and also deploy all plugins required.
![alt text][1]
The installation will add the following directory to your system PATH:
*C:Program Files (x86)HPLeanFTbin*

2) Browser Setup

A few setting(s) you should perform for different browsers before we dive into the code:


In the Firefox browser menu, select Add-ons and then click Extensions. Drag the *Agent.xpi* file from the %LeanFT%InstallationsFirefox folder to the Firefox Extension page and click 'Install now'.


If you are testing against Chrome, ensure the LeanFT plugin is enabled from *Chrome Settings -> Extensions*

**Internet Explorer**

With IE, go to *Settings -> Manage Addons* where HP Functional Testing Agent must be enabled.

3) LeanFT Test

HP provides a LeanFT-JUnit template which would perform all of the initializations. We are showing how to use the template but also there is a way on how to perform the configuration without it, so you don't have to use a template or even extend the UnitTestClassBase

If you use the LeanFT-JUnit template or extend from UnitTestClassBase, all required configurations would already be taken care of. No extra steps required. UnitTestClassBase extends from UnitTestBase.
Example of the project structure:
![alt text][2]

Sample code using the template:

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import unittesting.UnitTestClassBase;

import com.hp.lft.sdk.web.*;

public class LeanFtMercuryTours extends UnitTestClassBase {
public static void beforeClass() throws Exception {

public static void afterClass() throws Exception {

public void test() throws Exception {
Browser browser = BrowserFactory.launch(BrowserType.CHROME);
browser.describe(EditField.class, new XPathDescription(''//input[@name='userName']'')).setValue(''test'');
browser.describe(EditField.class, new XPathDescription(''//input[@name='password']'')).setValue(''test'');
browser.describe(Image.class, new XPathDescription(''//input[@name='login']'')).click();

Running the above code will generate the below report in your projectFolder/RunResults directory

You can find some additional information in regards to this in the following article:

Finally, it is important to keep in mind that there are a few limitations with LeanFT (Please check the complete documentation):

* The LeanFT Eclipse plugin currently does not provide the application model functionality.

* The LeanFT HTML Report cannot be viewed in a Firefox browser.

* When using the Highlight option in the application model for a test object with VRI objects defined, the highlight operation succeeds only if exactly one object matches the description (including the VRI definitions). If multiple objects match, nothing is highlighted. Workaround: Use the VRI Preview option to check the description.

[1]: /storage/temp/315-img1.jpg
[2]: /storage/temp/316-im2.jpg

Marked as spam
Posted by (Questions: 2, Answers: 425)
Answered on August 7, 2015 12:50 pm
Private answer

thank you. help very information

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on August 14, 2015 9:27 pm
Private answer

I have the same Junit LeanFT project setup created shown in example, but when I execute the script I am getting com.hp.lft.sdk.generalservererrorexception. The Junit is not identifying the brower object.How do i go about this?

Thanks in advance for any solutions...

Marked as spam
Posted by (Questions: 0, Answers: 2)
Answered on January 7, 2016 1:44 pm
Private answer

your suggestions are valuable..

Marked as spam
Posted by (Questions: 0, Answers: 2)
Answered on January 7, 2016 1:46 pm