# Integrate LeanFT and BPT

If you are working with BPT, you can add LeanFT business components to flows and business process tests.

For details on creating flows and business process tests, see the ALM Help Center.

Note: LeanFT business components cannot be mixed with other types of business components in flows and business process tests.

## Create business process tests that include LeanFT business components

After you have written your LeanFT test, you can set up a corresponding business process test in ALM containing your test methods by creating business components in ALM's Business Components module and using them in a business process test

This can be done in one of the following ways:

Manually create business components | Create a business component in ALM for each test method in your LeanFT test script.
Import LeanFT test methods into business components in ALM | Using a tool, you can create business components for multiple test methods simultaneously. Recommended if you want to migrate a large number of test methods to business components in ALM.

Manually create business components

When defining business components manually:

1. In ALM, create a new business component, or select an existing one.

2. Add a LeanFT automation:

   Note: Each LeanFT business component represents a single test method inside a LeanFT test class.

   In the Automation tab, click Add Automation, and select LeanFT automation subtype.

3. In the Automation tab, define your business component. Provide values for the required fields as follows:

   Framework | Select the framework you are using.
   JAR/DLL Path | The path of the .dll or .jar file containing your test, depending on the framework. You can specify either a full file path or a relative path.
   Fully Qualified Class Name | The fully qualified name of your class, including the namespace (NUnit/MSTest) or package (JUnit/TestNG).
   Test Method Name | The name of the test method that your business component will run.

4. Example:

Import LeanFT test methods into business components in ALM

The export/import procedure is identical for business components as for LEANFT-TEST tests.

1. In LeanFT:

   1. In your test project, compile the DLL or export the JAR.

   2. Run the export tool command line utility relevant to your testing framework, as described in Import LeanFT tests into ALM.

2. In ALM:

   1. In the Business Components module, select Components > Import LeanFT Components.

   2. Select the XML file generated with the LeanFT export tool, and click Open.

   3. Select the test methods to import to business components, and click Import.

      Example:

   A new business component is created in ALM for each selected test method, with all required fields defined.

Back to top

## Data driving business components

Just as in any LeanFT test, you can expand the scope of your business components by creating content using defined input values. In addition, for business components, you can define output parameters as well.

Input parameters

Define input values the same way as you would for LeanFT tests. For details, see Data-drive your ALM tests.

Output parameters

Define output parameters for business components per your framework as follows:

NUnit

Add a new OutputParameters attribute with the names of your output parameters just below the TestCaseSource attribute using the following format:

`[OutputParameters("Out1", "Out2", .... , "OutX")]`

For example:

    public string Out_BookIsbn;

    [TestCaseSource("ALM")]
    [OutputParameters("Out_BookIsbn")]
    public void SearchBook(string bookTitle, string bookAuthor)
    {
    	bookTitleEditField.SetValue(bookTitle);
    	bookAuthorEditField.SetValue(bookAuthor);
    	searchBtn.Click();
    	Out_BookISBN = bookIsbnEditField.Value;
    }

MSTest

Use the [OutputParameters( parameter_names )] attribute to mark the class variable as an output parameter for the business component.

Note: Because of MSTest’s test structure, the class variables that are mapped to output parameters should be static.

For example:

    public static string Out_BookIsbn;

    [TestMethod]
    [DataSource("ALM")]
    [Parameters("Title", "Author")]
    [OutputParameters("Out_BookIsbn")]
    public void SearchBook()
    {
    	var title = Convert.ToString(TestContext.DataRow["Title"]);
    	var author = Convert.ToString(TestContext.DataRow["Author"]);
    	bookTitleEditField.SetValue(title);
    	bookAuthorEditField.SetValue(author);
    	searchBtn.Click();
    	Out_BookISBN = bookIsbnEditField.Value;
    }

JUnit

Add the @OutputParameters({<output_parameter_name_list > }) annotation with the names of your output parameters to your test method. For example:

    @Parameter(0)
    public String Title;
    @Parameter(1)
    public String Author;

    public String Out_BookIsbn;
    public String Out_BookPrice;

    @Test
    @OutputParameters({"Out_BookIsbn", "Out_BookPrice"})
    public void test() throws Exception {
    	bookTitleEditField.setValue(Title);
    	bookAuthorEditField.setValue(Author);
    	searchBtn.click();

    	Out_BookISBN = bookIsbnEditField.getValue();
    }

TestNG

Add the @OutputParameters({ parameter_name_list}) annotation to your test method to mark the class variable as an output parameter for the business component.

    public String Out_BookIsbn;
    public String Out_BookPrice;

    @Test(dataProvider="ALM")
    @Parameters({"Title", "Author"})
    @OutputParameters({"Out_BookIsbn", "Out_BookPrice"})
    public void test(String title, String author) throws Exception {
    	bookTitleEditField.setValue(title);
    	bookAuthorEditField.setValue(author);
    	searchBtn.click();
    	Out_BookISBN = bookIsbnEditField.getValue();
    }

Back to top

Next steps:

- Configure the LeanFT host computer
- Run your LeanFT test from ALM

https://admhelp.microfocus.com LeanFT 8942
Tips to improve your search results...TOC Lean Functional Testing Help Center LeanFT Help Center 14.50 - 14.53 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version:(Undefined variable: _rscC_Basic_Variables.FloatingTocShow)