Integrate mobile tests and Jenkins

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

Set up Jenkins and connect to Mobile Center

Set up a Jenkins connection to Mobile Center.

Do the following:

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

  3. In the Mobile Center section, click Add MC server.

  4. Enter a meaningful name for the Mobile Center server that you will be using, and its URL.

  5. Repeat the last two steps for each of the Mobile Center servers that you will be accessing.

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

  7. Click Apply or Save to keep your changes.

Connecting via SSL

To connect to Mobile Center 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.

Uploading apps

For details about uploading apps to Mobile Center using Jenkins, see the Mobile Center Help.

Back to top

Run Mobile tests from Jenkins

Run your UFT mobile test using both Jenkins and Mobile Center.

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. Enter the Mobile Center details and define settings for your test.

    Do the following:

    1. Select the MC server from the drop down list.

    2. Click the Wizard button.

    3. Provide the user credentials and connect to the Mobile Center 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 Mobile Center Help.

    4. Log into Mobile Center.

    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: Alternately, 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 parallel running mode

    Select to run your test on multiple environments.

    Then, add fields for new tests and environments as needed. Use the MC Wizard to define environments for each test defined.

    Note: When parallel testing is configured, any environments you defined in the Mobile Center 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 run mode for your tests:

    1. Select UFT-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 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 Mobile Center server for connectivity issues, security issues, and so forth.

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 a .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>

Back to top

Run Jenkins jobs sequentially on different devices

Run multiple, sequential Jenkins jobs using different devices, on the same UFT 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 slaves.

Do the following:

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

    For details, see Set up Master and Slaves in the Jenkins wiki.

  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 slaves have different labels. You can also use the values assigned to the slaves 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: