Create tests in ALM

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

Set up your testing project

  1. In OpenText Functional Testing for Developers, create a project containing one or more test methods. For details, see Create a testing project or module.

  2. Compile the DLL or create the JAR.

OpenText Functional Testing for Developers ALM APIs

OpenText Functional Testing for Developers 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 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 tests in ALM

Each test method in your OpenText Functional Testing for Developers 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 OpenText Functional Testing for Developers test script.
Import 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 test method that your ALM test will run.

    • For a Cucumber project, use #all_methods#.
    • You can also use the #all_methods# keyword for JUnit tests, 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 tests into ALM

Use the OpenText Functional Testing for Developers Test Export tool to export your test methods. Then, on the ALM side, use the OpenText Functional Testing for Developers 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 <Installdir>\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 OpenText Functional Testing for Developers Tests.

    2. Select the XML file generated with the export tool in OpenText Functional Testing for Developers 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: