UFT and Jenkins

Run UFT tests as part of your Jenkins continuous integration process.

Set up your Jenkins server with the Application Automation Tools plugin

Set up your Jenkins server to run UFT tests.

Do the following:

  1. Install Jenkins and the Application Automation Tools plugin. For details, see the Jenkins wiki.

  2. From the Jenkins Server home page, click New Job, or select an existing job.

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

  3. Select Build a free-style software project, and click OK.

Continue with one of the following:

Back to top

Set up a job to run local UFT tests

Set up a job to run one or more local UFT tests.

Do the following:

  1. In the General section of your Jenkins job, select Restrict where this project can be run, and then select the appropriate node.

    For more details, see Create an execution node on the Application Automation Tools Jenkins wiki.

  2. Scroll down to the Build section, click Add build step, and select Execute Micro Focus tests from file system.
  3. 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.

  4. Optional settings:

    UFT parallel running mode

    Select to run your test on multiple environments.

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

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

    In the Post-build Actions section, click Add post-build action, and select Publish Micro Focus test results.

    Select one of the following archiving options:

    Archive test reports for failed tests Only save test result reports for failed tests.
    Always archive test reports Always save test result reports.
    Do not archive test reports Never save the test results.
  7. Run or schedule the job as you would with any standard Jenkins job.

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

Back to top

Run tests on multiple environments in parallel

Configure Jenkins to run a series of sequential web or mobile tests, on multiple environments in parallel.

When configured, each test is run sequentially. While running each test, multiple environments are tested in parallel.

Do the following:

  1. In the Execute Micro Focus tests from file system build step, select the UFT parallel running mode option.

  2. Define one or more environments for each execution set of tests using the UI configuration dialogs.

Note: To run tests on mobile devices, you must have a Mobile Center connection configured.

For details, see Integrate mobile tests and Jenkins.

Define your parallel tests

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.

  • Alternately, indicate a batch file that contains a list of tests and parameters. For details, see Use a batch file to specify multiple tests.

Define your parallel environments

Do the following:

  1. Select Mobile or Web.

  2. Click Environment wizard to select a browser or device.

  3. Click + Environment to add a new environment for your execution set. UFT supports up to four parallel test runs.

    If you configure more than four environments, each subsequent environment will wait in queue.

  4. Click + EXECUTION SET to add a new set of tests to run, with their own environments defined.

Back to top

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

Review test run results

To view your UFT test results, do the following:

  1. Click the UFT Report icon in the left toolbar. The UFT report page opens with a table listing the test runs (test name, status, link to the report, etc.)

  2. Click on a link to open the desired report:

    • HTML Report: The browser opens the HTML report.

      If you ran multiple tests in parallel, your report includes results from all tests run. For more details, see Sample ParallelRunner response and run results.

    • Run Results Report: The download of the zip file begins. Extract its contents. The extracted zip file contains the result files, viewable in the Run Results Viewer.

Note: If you are viewing the log for this build job, you will see a number of timeout messages displayed, including PerScenarioTimeout and FileSystemTestRunner.

The PerScenarioTimeout can be ignored as it is only relevant for LoadRunner tests.

Back to top

Run functional test sets from ALM

Use Jenkins to run server-side, unattended functional tests from test sets in ALM. ALM test sets enable you to organize test execution in the ALM Test Lab module according to specific testing goals.

Note: Parallel testing is not supported for running tests from ALM.

For details, see the ALM Help Center.

Set up a Jenkins job to trigger a test set run from ALM

Do the following:

  1. In the Jenkins job, scroll down to the Build section, click Add build step, and select Execute functional tests from Micro Focus ALM.

  2. Select one of the configured ALM servers, and enter the server credentials, project, and domain.

    Note: If you are using the ALM scheduler, it will run under the Jenkins agent user.

    For example, if Jenkins is running as a System user, the scheduler will run the tests as a System user. This will not affect test execution.

  3. Add the test set folders, or the specific test sets that you want to include, using the ALM path.

    • To add a specific test, add the test name after the test set path.

    • To add multiple entries, click the down arrow on the right of the field, and enter each item on a separate line.

      For example:

      Root\testfolder1\testset_a

      Root\testfolder1\testset_b

      Root\testlab_folder

      Root\testlab_folder\testset_a\test-name

  4. Optionally, indicate a timeout, in seconds, after which the job will fail.

  5. Click Advanced to indicate a Run mode, such as local, remote, or planned host.

    Note: If you specify a remote host mode, also specify a host name. This must be a machine with a valid UFT installation.

  6. Click Apply to save your changes and continue with more build steps. Click Save when you are finished adding build steps.

  7. In the Post-build Actions section, click Add post-build action, and select Publish Micro Focus test result.
  8. Run or schedule the job as you would with any standard Jenkins job.

Review the results from ALM

Do the following to view test run results from ALM:

  1. From the dashboard, click on the job.
  2. Click the Console link to view the ALM information.
  3. Copy the ALM link to your Internet Explorer browser and view the Test Set results from within ALM.

Back to top

See also: