Integrate mobile tests and Jenkins

Run your UFT One Mobile tests directly from a Jenkins continuous integration server as part of your product build process.

Set up Jenkins and connect to Digital Lab (UFT Mobile)

Set up a Jenkins connection to Digital Lab (UFT Mobile).

Do the following:

  1. Install Jenkins and the Application Automation Tools plugin. For details, see the Jenkins plugin page.
  2. On the Jenkins Server home page, click Manage Jenkins > Configure System.

  3. In the UFT Mobile section, click Add UFT Mobile server.

  4. Enter a meaningful name for the Digital Lab (UFT Mobile) server that you will be using, and its URL.

  5. Repeat the last two steps for each of the Digital Lab (UFT Mobile) servers that you will be accessing.

  6. If UFT One and Jenkins are hosted on separate machines, create an execution node for the functional test.

  7. Click Apply or Save to keep your changes.

Connect via SSL

To connect to Digital Lab (UFT Mobile) using SSL, select Use SSL in the Job Configure page.

If you are using a CA certificate, you must first install the certificate on your Jenkins machine. For details, see Install your CA certificates on a Jenkins machine.

Upload apps

For details about uploading apps to Digital Lab (UFT Mobile) using Jenkins, see the Digital Lab (UFT Mobile) Help.

Back to top

Define Digital Lab (UFT Mobile) server credentials on the Jenkins server

Define credentials that Jenkins uses to connect to the Digital Lab (UFT Mobile) server when running mobile tests.

Application Automation Tools plug-in version Credentials
Earlier than 7.4

Enter the username and password in each job that runs mobile tests.

7.4 and later

UFT One version 2021 R1 Patch 1 or later

Define either a username and password or an Access Key in each job that runs mobile tests, depending on the Digital Lab (UFT Mobile) server requirements.

Back to top

Run Mobile tests from Jenkins

Run your UFT One mobile test using both Jenkins and Digital Lab (UFT Mobile).

Do the following:

  1. On the Jenkins Server home page, click New Item, or click an existing item.

    If you select to create a new item, enter the item name.

  2. Select Build a free style project and click OK.

  3. In the General tab, scroll down to the Build section.

  4. Expand the Add build step drop-down and select Execute Micro Focus tests from file system.

  5. Click UFT Mobile options and enter the Digital Lab (UFT Mobile) details, defining settings for your test.

    1. Select the Digital Lab (UFT Mobile) server from the drop down list.

    2. Click the Wizard button.

    3. Provide the user credentials and connect to the Digital Lab (UFT Mobile) server.

      The user credentials can either be a username and password or an Access Key. For details, see Define Digital Lab (UFT Mobile) server credentials on the Jenkins server.

      Note: If workspaces are enabled, you must also include the nine-digit tenant ID with your user name in the format username#ID. For example, admin@default.com#999999999.

      For more details, see the Digital Lab (UFT Mobile) Help.

    4. Log into Digital Lab (UFT Mobile).

    5. In the wizard, select a device, choose apps, and configure the settings for your test. Click SAVE AND CLOSE.

  6. In the Tests box, enter a test with its full absolute path, or a folder or MTB containing one or more tests.

    To specify multiple entries, click the down arrow on the right of the field and enter each test path on a separate line. Make sure that the paths are accessible from all machines in the local network.

    Tip: Alternatively, indicate a batch file that contains a list of tests, along with their parameters. For details, see Use a batch file to specify multiple tests.

  7. Optional settings:

    UFT One parallel running mode

    Select to run your test on multiple environments.

    Then, add fields for new tests and environments as needed. Use the Digital Lab (UFT Mobile) Wizard to define environments for each test defined.

    Note: When parallel testing is configured, any environments you defined in the Digital Lab (UFT Mobile) wizard (see above) are ignored during your test run.

    For more details, see Run tests on multiple environments in parallel.

    Timeout Indicate a timeout, in seconds, after which the job will fail.
    Run Mode

    Define a UFT One run mode for your tests:

    1. Select UFT One-specific settings.
    2. From the Run Mode dropdown list, select Fast or Normal.

    For more details, see Test Runs Pane (Options Dialog Box > GUI Testing Tab).

  8. Click Apply to save your changes and continue with more build steps. Click Save when you are finished adding build steps.
  9. Add a post-build action to define settings for the UFT One test results.

    In the Post-build Actions section:

    1. Click Add post-build action, and select Publish Micro Focus test result.
    2. Select the Always archive Micro Focus test reports option.
  10. Run or schedule the job as you would with any standard Jenkins job.

    When test is completed, continue with Review test run results.

Tip: To troubleshoot, check the log file on the Digital Lab (UFT Mobile) server for connectivity issues or security issues.

Use a batch file to specify multiple tests

Configure the Jenkins job to trigger multiple tests by specifying the tests in a batch file, together with their parameters.

Specify multiple tests, or even the same test several times, each time with different parameters. When specifying the path to your tests, Jenkins environment variables are supported for path names.

Give your batch file an .mtbx extension, and use the following sample syntax:

<Mtbx>
 <Test name="test1" path="c:\tests\APITest1">
 <Parameter name="A" value="abc" type="string"/>
 ….
 </Test>
 <Test name="test2" path="${WORKSPACE}\test2">
  <Parameter name="p1" value="123" type="int"/>
  <Parameter name="p4" value="123.4" type="float"/>
  ….
 </Test>
</Mtbx>

Pass parameters from one test to another in a batch test run

Supported on Application Automation Tools plugin version 7.6 and later

You can pass an output parameter from one test as an input parameter in another test. To do that, do the following:

  1. In UFT One, define the output parameters to use as inputs for subsequent tests in each test.

  2. In each <Parameter> element in the batch file, you can leave the value empty and include a source attribute specifying the name of the output parameter whose value should be used.

    Example:

    <Test name="test2" path="c:\tests\GUITest1">
    <Parameter name="inputParam1" value="" type="string" source="outParam1"/>
    …
    </Test>

Note:  

  • When specifying the first test in a batch test run, leave the source attribute empty.

  • If there are 3 tests (A, B, C) in a test batch, parameters cannot be passed directly from A to C.

Back to top

Run Jenkins jobs sequentially on different devices

Run multiple, sequential Jenkins jobs using different devices, on the same UFT One machine.

Do the following:

  1. Set up multiple jobs using different devices.

  2. For the second job, browse to the Jenkins Configuration page and locate the Build Triggers section. (Manage Jenkins > Configure System)

  3. Select the Build after other projects are built option, and in the Projects to watch field, enter the first job name.

  4. Optionally, select Trigger only if build is stable.

  5. Click Apply to save your changes and continue with more build steps.

    Click Save when you are finished adding build steps.

Back to top

Run different Jenkins jobs with different devices in parallel

Run different Jenkins jobs with different devices in parallel on different agent machines.

Do the following:

  1. Set up the agent machines, and ensure that UFT One is installed on each one.

    For details, see Using Jenkins agents in the Jenkins documentation.

  2. Select Manage Jenkins > Manage Nodes and click the Configure icon to open the Configure page node.

  3. Enter the labels in the Labels fields.

    Make sure that the agents have different labels. You can also use the values assigned to the agents from the previous steps.

  4. Open the Configure page for each job, and select Restrict where this project can be run.

  5. In the Label Expression, enter the labels that you defined earlier.

  6. Save your changes.

Back to top

See also: