Use Jenkins to trigger UFT One tests from ALM

This topic describes how to run UFT One tests saved in ALM.

Define ALM credentials on the Jenkins server

Define and use the ALM credentials that Jenkins uses to connect to ALM when running UFT One tests saved in ALM.

Jenkins plugin version ALM credentials
6.3 and earlier

Enter the credentials in each job that runs UFT One tests from ALM.

6.4 to 7.0

Define the ALM credentials globally on the Jenkins configuration page (Manage Jenkins > Configure System, Application Lifecycle Management section).

You can define credentials for multiple ALM servers and for multiple users on the same ALM server.

Define either usernames and passwords or client IDs and API key secrets, depending on the ALM server requirements.

Then, in a job that runs UFT One tests from ALM, select from the configured ALM usernames or ALM Client IDs as necessary.

7.1 and later

Select one of the following credential handling modes from the Credential Scope drop down.

  • System (global) credentials: Define the ALM credentials globally on the Jenkins configuration page.

  • Job (local) credentials: Define the ALM credentials in each job.

Note: If you upgrade to Jenkins plugin version 7.1 or later, for any jobs you previously configured, the first credential handling mode System (global) credentials is used by default.

If you defined ALM credentials within your jobs, and subsequently upgraded to a Jenkins plugin version between 6.4 and 7.0: 

  • You cannot edit the credentials within the jobs but Jenkins continues to use them when running the job.

  • You can automatically move ALM credentials defined in existing Jenkins jobs to the Jenkins global configuration area:

    Create and run a Jenkins job with the post-build action Migrate ALM Credentials. The first run of this job migrates the ALM credentials from all jobs to the Jenkins configuration page. Subsequent runs do nothing.

Back to top

Run UFT One tests from ALM test sets

Use Jenkins to run server-side and 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.

To configure a Jenkins build step to trigger a test set run from ALM

  1. In the Jenkins job, scroll down to the Build section, click Add build step, and select Execute functional tests from Micro FocusALM for a freestyle project.

    Note: For a pipeline, in the Pipeline Syntax page, select runFromAlmBuilder from Sample Step drop-down, generate the script, and copy the script to the pipeline script box.

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

    Depending on the authentication type required by your ALM server, credentials can either be a username and password or an API key for SSO authentication.

    To use SSO authentication, select the SSO enabled and enter the Client ID and API key secret obtained from your ALM site administrator.

    For more details, see Define ALM credentials on the Jenkins server.

    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. (Optional) Add test parameters to use for the tests.

    In the Test sets area, use the following syntax:

    <test or test set path> "<parameter name>":"<string value>", "<parameter name>": <number value>

    Where:

    • <test or test set path> is the path to the test or test set.

      If you specify a test, the specified parameters are used for that test only.

      If you specify a test set, the specified parameters are used for all of the tests in that test set. When the test set runs, each test uses the parameters it requires and ignores any others.

    • <parameter name> is the name of your test parameter

    • <string value> is a string value for your parameter, in quotes

    • <number value> is a number value for your parameter, without quotes

    For example:

    TestSet\ "Country":"US", "Count": 3

    TestSet2\ "Country":"UK"

    TestFolder\Test1 "Country":"China", "Count": 4

    Tip: Specify values for all test parameters required by your tests, or make sure that the parameters have default values defined in UFT One or ALM.

  5. (Optional) Indicate a timeout, in seconds, after which the job will fail.

  6. (Optional) Set up a filter for your ALM test set, instructing Jenkins to run only part of the test in the test set.

    Select Filter ALM test sets, and filter the tests to run by name or status or both: 

    • In Run tests with names containing, specify a string to find within the test names.

    • In Run tests with status, specify the statuses of the tests you want to run. For example, if you don't want to rerun tests that already passed, don't select the Passed status.
  7. 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 One installation.

    You can configure the UFT One machine so that Jenkins can run tests without anyone manually logging in to the machine and starting UFT One. For details, see Running UFT One and UFT One tests in a remote session.

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

  9. In the Post-build Actions section, click Add post-build action and select Publish Micro Focus test result for the freestyle project.

    Note: For a pipeline, in the Pipeline Syntax page, select publishMicroFocusTestResults from Sample Step drop-down, generate the script, and copy the script to the pipeline script box.

  10. Run or schedule the job as you would with any standard Jenkins job.

To review the 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: