Create UFT Developer tests in ALM

This topic includes information on creating a UFT Developer test that can be run from ALM. You can use the UFT Developer ALM APIs in your tests to retrieve information on ALM that is important to you. Aside from creating the tests in UFT Developer, you also need to create parallel tests in ALM, as described in Create UFT Developer tests in ALM.

Set up your UFT Developer project

  1. In UFT Developer, create a UFT Developer project containing one or more test methods. For details, see Create a UFT Developer testing project or module.

    • These test methods can be defined in a single .cs or .java file, or in multiple files within your project.
    • Use UFT Developer ALM APIs in your test script.
  2. Compile the DLL or create the JAR.

UFT Developer ALM APIs

UFT Developer includes a set of comprehensive methods for retrieving information on your ALM environment, such as the ALM project name or the ALM server domain name. This capability is supported for all ALM testing frameworks (JUnit, NUnit, and TestNG).

You can retrieve information for both regular test runs and business components runs.

Retrieve ALM information using the getAlmRunInfo method in the ALMUtils class.

Example:  

AlmRunInfo runInfo = AlmUtils.getAlmRunInfo();

The getAlmRunInfo method returns an AlmRunInfo class when the test is run from ALM. If the test is not run from ALM, it returns NULL.

Retrieve business component information using the getBusinessComponentRunInfo method in the AlmRunInfo class.

Example:  

AlmRunInfo almRunInfo = AlmUtils.getAlmRunInfo();
if (almRunInfo != null) {
	BusinessComponentRunInfo bcRunInfo = almRunInfo.getBusinessComponentRunInfo();
}		

The getBusinessComponentRunInfo method returns a bcRunInfo class when the test is run from ALM. If the test is not run from ALM, it returns NULL.

For details on all the properties you can retrieve, see the .NET and the Java SDKs.

For full code examples, see Code examples.

Create UFT Developer tests in ALM

Each test method in your UFT Developer project that you want to run in ALM must be mapped to an ALM LEANFT-TEST test.

This can be done in one of the following ways:

Manually create LEANFT-TEST tests in ALM Create a LEANFT-TEST test in ALM for each test method in your UFT Developer test script.
Import UFT Developer tests into ALM

Use the import tool to create LEANFT-TEST test for multiple test methods simultaneously.

Recommended if you want to migrate a large number of test methods to ALM.

Manually create LEANFT-TEST tests in ALM

  1. In the ALM Test Plan module, create a test, and select the LEANFT-TEST test type.

  2. In the test plan tree, select the LEANFT-TEST test you just created.
  3. In the Test Script tab of the test, define your test. Provide values for required fields, as follows:

    Framework

    Select the framework you are using.

    JAR/DLL Path

    The path of the .jar or .dll file containing your test.

    Specify either a full file path or a path relative to that specified in the <TestAssetsDir> element of the LFTRemoteAgent.exe.config file.

    Fully Qualified Class Name

    The fully qualified name of your class, including the namespace (NUnit/MSTest) or package (JUnit/TestNG).

    Syntax: <package/namespace name>.<classname>

    Test Method Name

    The name of the UFT Developer test method that your ALM test will run.

    • For a Cucumber project, use #all_methods#.
    • You can also use the #all_methods# keyword for other test types, to instruct ALM to run all the methods in the test class.

    Example:  

    Repeat for each test method that you want to include in your ALM test plan.

Import UFT Developer tests into ALM

Use the UFT Developer Test Export tool to export your test methods. Then, on the ALM side, use the UFT Developer Test Import tool to import the test methods into ALM LEANFT-TEST tests.

  1. From the command line, run the export tool relevant to your testing framework. These are located in the <UFT Developer installation>\Tools\TestExportTool folder.

    The export tool generates an XML file with the same name and in the same location as the DLL or JAR you provided.

    Example: C:\UFT Developer\MyJUnitTests.xml.

  2. In ALM, in the Test Plan module, run the ALM import tool:

    1. Select Tests > Import UFT Developer Tests.

    2. Select the XML file generated with the export tool in UFT Developer and click Open.
    3. Select the test methods to import and click Import.

      Example:  

      A LEANFT-TEST test is created for each selected test method, with all required fields defined.

Back to top

Code examples

The following are full code examples for creating a test using the ALM APIs.

.NET examples

Java examples

Back to top

Next steps:

Got it!
Welcome to the help center for UFT Developer, formerly known as LeanFT. UFT Developer is part of the new Micro Focus UFT family of integrated functional testing solutions.