Jenkins and HP ALM Integration Guide

Why you need Bumblebee

In many organizations, Jenkins is used to build software, run unit tests, and run various kinds of testing frameworks. Example: Selenium, JUnit, Pytest, TestNG, Visual Studio Test, etc. These test metrics are very important and should be reflected in HP ALM to show the true health of any project. Bumblebee plugin for Jenkins allows users to integrate any testing framework with HP ALM without making any code changes or writing custom tools. In addition, the plugin allows you to run HP ALM tests directly from Jenkins. Many organization use Bumblebee and Jenkins to achieve CICD.

Integrating Jenkins with HP ALM is super simple by using Bumblebee's plugin for Jenkins. Bumblebee's Jenkins plugin allows you to do the following:

  1. Export test results to HP ALM and automatically create TestPlan, TestLabs, TestsSets, and TestRuns. This is extremely useful for running tests directly in Jenkins and automatically these test results in HP ALM.
  2. Schedule Tests in HP ALM from Jenkins and show their status in Jenkins and HP ALM
  3. Run local UFT tests and report execution results in both Jenkins and HP ALM
  4. Run HP Performance Center tests from Jenkins

- Install plugin

Bumblebee Jenkins plugin can be installed via the Jenkins update center

jenkins

Install Bumblebee Server before configuring the Jenkins plugin

Bumblebee Jenkins plugin communicates with HP ALM via the Bumblebee server. You must install Bumblebee server before configuring the Jenkins plugin. Bumblebee server setup instructions

- Configure plugin

Configure the Jenkins plugin global settings. manage Jenkins → Manage Jenkins → Configure System

Install Bumblebee Server before configuring the Jenkins plugin

Bumblebee Jenkins plugin communicates with HP ALM via the Bumblebee server. You must install Bumblebee server before configuring the Jenkins plugin. Bumblebee server setup instructions

jenkins

Field Name Description
BumbleBee URL URL for bumblebee server. Must end with /bumblebee. Example: http://some-server:8888/bumblebee
HP ALM URL URL for your HP ALM instance. Must end with /qcbin. Example: http://your-alm-server:8080/qcbin
HP PC URL URL of HP Performance Center. Leave it empty if you will not be using plugin for running tests in HP Performance Center
HP ALM User Name of the HP ALM user to connect to ALM instance.
HP ALM User Password Password for HP ALM user to login into ALM
UFT Batch Runner The default path to the UFT Batch Runner (UFTBatchRunnerCMD.exe) on all slaves. It can be overridden by setting UFT_RUNNER environment variable on an agent. Leave it empty if you will not be using plugin for running local UFT tests.
Upload timeout The number of minutes to wait for the Bumblebee server to process the request. 0 means wait indefinitely. Uploading of test results into HP ALM might take a few minutes depending upon the number of tests that must be processed.

Save Configuration to save your changes. Saving may take a few seconds because the Bumblebee plugin will validate the configuration before saving.


- Export Tests Results

Bumblebee's Jenkins plugin allows automatic export of Jenkins build's test results to HP ALM. Bumblebee supports a variety of test results formats like JUnit, NUnit, testNG, Fitnesse, and Cucumber. To enable this feature, configure the Jenkins job and add Bumblebee HP ALM Uploader post-build step. In this step, configure a few fields and specify the results that need to be published.

jenkins

Bumblebee HP ALM Uploader configuration fields details

Field Name Required Description
Domain Yes The name of HP ALM domain where to export test results
Project Yes The name of HP ALM project
Test Plan Yes TestPlan path in HP ALM where tests should be saved. Must start with Subject\
Test Lab Yes TestLab path in HP ALM where test results should be saved. Must start with Root\
Test Set Yes The name of test set in HP ALM
Format Yes Format of test results generated by previous tasks in the same job. Available values: junit, nunit, testng, fitnesse, cucumber
Results File Pattern Yes Provide path to the XML file(s) generated during the build.This is a comma separated list of test result directories.You can also use Ant style patterns such as **/surefire-reports/*.xml
HP ALM Mappings No If ALM Mappings are configured on the Bumblebee server, their values can be specified in this field.The format is [alm field label 1]=[value 1], [alm field label 2]=[value 2].. The label values can be Jenkins environment variables. You can also directly specify the default value on the Bumblebee server. Please refer to Bumblebee server documentation for details on configuring HP ALM mappings.
Fail build if upload unsuccessful N/A If checked, the build will be marked as failed if for any reason the plugin was not able to upload the results. This could be due to Bumblebee server issues, HP ALM server issues, network issues, etc.
Process offline N/A If checked, Bumblebee will send test reports to be processed in a background thread on the Bumblebee server. This option is useful if you notice a large increase in build time due to Bumblebee's real-time test results processing.

configure ALM mappings (optional)

If your ALM project has custom user fields and you have already configured ALM Mappings, you can easily specify them in the Jenkins post-build step as name-value pairs. If you don't specify them in the Jenkins step, Bumblebee will use the custom field values from the server (if they exist).

jenkins

Once the job is configured, simply build the job. The build console will show the Bumblebee Jenkins plugin to Bumblebee REST API activity. This output is quite useful for troubleshooting.

jenkins

All the results will be processed by Bumblebee server and corresponding TestPlan, TestLab, Testset, and TestRun will be created automatically.

jenkins

jenkins


- Offline processing

Processing of test results can add a few minutes to your build time. If this is not desirable, Bumblebee provides an option for processing tests results in a background thread on the Bumblebee server. Simply check the Process offline checkbox in the job configuration to enable this feature.

jenkins

When Process offline is enabled, the console output will be

jenkins offline

The console output will contain a link to the processing queue item.

jenkins offline

To view all the offline tasks being processing, simply navigate to Offline Processing Queue from the Bumblebee Server main page

bumblebee config

bumblebee queue


- Running ALM Tests from Jenkins

Bumblebee's Jenkins build step allows you to run tests stored in HP ALM (UFT, LeanFT, QTP, etc) directly from Jenkins and view the results in both Jenkins and HP ALM.

- Prerequisites

  • Job must run on the Jenkins slave installed on Windows machine
  • Jenkins slave must have launch method: Launch slave agents via Java Web Start
  • Jenkins slave must NOT run as windows service
  • Appropriate version of HP ALM Connectivity Tool must be installed on Jenkins slave machine. Tool is available at http://your_alm_server_and_port/qcbin/PlugIns/TDConnectivity/TDConnect.exe
  • Appropriate version of HP ALM Client must be installed on Jenkins slave machine. Available at http://your_alm_server_and_port/qcbin/start_a.jsp?common=true

To run ALM Testset from Jenkins, add Bumblebee HP ALM Test Set Runner build step to the Jenkins job configuratoin

jenkins

Field Description
Domain The name of HP ALM domain
Project The name of HP ALM project
Test Sets A list of test sets to execute. Each test set path must start on a new line. Path must start with Root and specify the full path of HP ALM Testlab's TestSet. E.g. Root\folder1\testset1. In this example Root\folder1 is the TestLab folder and folder1 is the name of the TestSet to execute
Run Mode How to run test sets. Possible values: LOCAL - run all tests on agent's,machine, SCHEDULED - run tests on planned host, REMOTE - run on remote,host
Run Host The name of host on which tests shall be run. May be blank if Run Mode is LOCAL or SCHEDULED
JUnit Results Directory Directory where JUnit-like execution reports will be placed. If it does not exist, Bumblebee will create it
Timeout The number of minutes to wait for test sets execution. 0 means wait indefinitely.

When Jenkins build is executed, the Bumblebee HP ALM Test Set Runner step connects to HP ALM server and runs the specified ALM Testsets. The build waits till the test runs is completed in HP ALM.

Example: Jenkins build console

jenkins

Once the build is complete, Bumblebee HP ALM Test Set Runner transforms the HP ALM test results in a JUnit report compliant schema so that it can be published within Jenkins, using the standard Publish JUnit test result report post-build step.

jenkins

- Adding tests from HP ALM TestPlan to TestSet

If a single test or all tests in a TestPlan folder need to be added to HP ALM TestSet, then Bumblebee: Add Test to Test Set build step can be used:

jenkins

The step has the following configuration fields:

Field Description
Domain The name of HP ALM domain
Project The name of HP ALM project
Test Plan Path Path to a test or test folder in HP ALM TestPlan, e.g. Subject\testfolder\test1
Test Set Path Path to a HP ALM TestSet into which test(s) shall be added. If TestSet does not exist, Bumblebee will try to create it on the fly. Example: Root\testfolder\testSet

Console output:

jenkins

Results in HP ALM:

jenkins


- Running ALM Tests inside Jenkins

Bumblebee allows you to run HP Unified Functional Testing tests directly from Jenkins and reports results back to Jenkins.

- Prerequisites

  • Jenkins slave runs on Windows machine and have appropriate HP Unified Functional Testing version installed. Please see UFT requirements for a particular version of OS and other software.
  • Jenkins slave must run as a console application (not as a windows service)
  • UFT Batch Runner property of Global Configuration or UFT_RUNNER environment variable on slave must be set

To override path to UFT Batch Runner, defined in the Global Configuration, you need to set a UFT_RUNNER environment variable on a Jenkins slave.

To set a value to UFT_RUNNER environment variable of Jenkins slave:

  • Open Jenkins slave configuration page
  • Check "Environment variables" checkbox
  • Add a new variable and type "UFT_RUNNER" as "Name" and path to UFT Batch Runner on that slave as a "Value"
  • Click on "Save" button

jenkins UFT

To run UFT tests locally inside of Jenkins, add the Bumblebee Local UFT Test Runner build step in your jenkins job configuration.

Bumblebee Local UFT Test Runner build step has the following configuration parameters:

  • Test Path: The path to a test folder or test batch file (.mtb) which needs to be executed
  • Results Directory: Directory inside your project where Bumblebee can add JUnit-like execution reports. If it does not exist, Bumblebee will create it automatically.

jenkins

mtb file paths

If your .mtb files are located in some GIT repository, make sure paths to tests are correct and point to tests in build directory. You can use windows batch script for this.

Bumblebee Local UFT Test Runner step outputs the results of test execution as a standard JUnit style report in the JUnit Results Directory.

These reports can then be published using Publish JUnit test result report Post-build step.

jenkins uft junit

When Jenkins runs Bumblebee Local UFT Test Runner step, it will trigger local HP UFT Batch runner and record its output:

jenkins uft

Bumblebee Local UFT Test Runner step captures test results from the Jenkins build and produces a standard JUnit style report. If the job is configured to publish reports, you can view the tests results in Jenkins like any other JUnit style reports by going to the Test Results section:

jenkins uft

Bumblebee captures detailed errors as reported by UFT and dumps them in the reports.

jenkins uft

UFT also produces detailed reports with description of all steps, screenshots, etc. The Jenkins job can be configured to capture these as build artifacts. To enable this, add the Archive the artifacts Post-build step to the job configuration and define appropriate value for Files to archive

jenkins artifacts

After the build has finished, artifacts are displayed in the Artifacts build tab:

jenkins


- Running HP Performance Center Tests from Jenkins

HP Performance Center Tests + Jenkins

HP Performance Center is a powerful set of tools for composing and running performance tests and used by many companies. Bumblebee Jenkins plugin allows an easy way to schedule HP Performance Center tests and report results back to Jenkins.

- Prerequisites

Before creating a Jenkins job for running HP Performance Center tests, validate the Bumblebee Global Settings

- Configure Bumblebee HP PC Test Runner step

To configure a Jenkins job to run HP Performance Center tests, add the Bumblebee HP PC Test Runner build step.

Bumblebee HP PC Test Runner build step has the following configuration parameters:

Parameter name Description
Domain Domain name in HP ALM
Project Project name in HP ALM
Results Directory Directory to which test result files will be saved
Path To Test Path to a test in HP ALM TestPlan. Example: Subject\folder1\foo, where Subject\folder is the path to the test folder and foo is the name of a test to run
Test Set Path to the TestSet in HP ALM TestLab, containing corresponding test instances. Example: Root\folder1\testSet, where Root\folder1 is the path to the testlab folder and testSet is the name of the testset. If testset does not exist or test is not assigned to it, Bumblebee task will automatically create a new testset and assign a test to it.
Post Run Action Defines what PC should do after a test run. Available options: Collate And Analyze, Collate Results and Do Not Collate
Time Slot Duration Time to allot for the test (PC parameter). It cannot be less than 30 minutes (limitation by PC).
Use VUD Licenses If true, the test consumes Virtual User Day (VUD) licenses.
Timeout Overrides a global PC timeout value and represents the number of minutes to wait for the Performance Center test to finish. 0 means wait indefinitely.
Retry Attempts Number of retry attempts, before task completely fails.
Retry Interval Number of seconds to wait between retry attempts.
Interval Increase Factor Increase factor for retry interval. E.g. if it is set to 2, then each subsequent wait interval between attempts will be 2x the previous one.
Polling Interval The number of minutes between two test state requests.
Fail Build If Task Fails If true and task has failed (or timeout has reached), then the whole build will be failed. If false, then build will not be failed even if task has failed.

jenkins

- HP PC Results Configuration

HP Performance Center produces test reports that can be published inside Jenkins builds. Bumblebee HP PC Test Runner task automatically downloads these reports from the HP Performance Center server and copies them to the specified Results Directory.

To publish these reports inside Jenkins, add the Archive Artifacts post-build step to job configuration and define appropriate values for Files to Archive

jenkins

- Running HP PC Jenkins Job

When the Jenkins job is triggered it starts a new run in HP Performance Center for the test specified by Path To Test and Test Set properties of the task. Once the HP PC test has started, Bumblebee HP PC Task waits for it to finish and checks the run's possible Run States from time to time. If the test reaches one of the following states, Bumblebee assumes that test has passed:

  • Finished
  • Before Collating Results (if Post Run Action = Do Not Collate)
  • Before Creating Analysis Data (if Post Run Action = Collate Results)

If test reaches one of the following states or timeout has occurred, Bumblebee treats test as failed:

  • Canceled
  • Run Failure
  • Aborted
  • Failed Collating Results
  • Failed Creating Analysis Data

If a test has failed, Bumblebee marks the build as passed or failed based on the Fail Build If Task Fails job configuration property. If true, the build is marked as FAILED and build is aborted. If false, Bumblebee simply proceeds with the next test.

If an error occurs during fetching runs status from PC, Bumblebee will retry failed action according to the retry settings defined for a task.

Sample execution log:

jenkins