Skip to main content

Jenkins

Jenkins and Testing Results

info

Jenkins is one of the most popular CI applications and is used by thousands of companies all over the world. Jenkins is used to define the application build and test processes. QA teams also use Jenkins to run/schedule functional tests across a variety of tools and frameworks. However, the results of these tests can only be viewed in Jenkins, and it is not really possible to aggregate results across multiple jobs, retain long history, and delegate test failures to your team.

Micro Focus ALM + Jenkins + Railflow for ALM

info

By using the Railflow for ALM, you can easily integrate Jenkins testing jobs with Micro Focus ALM and automatically export all testing reports to ALM. Aggregating result from all your Jenkins jobs into ALM allows teams to look at test trends, manage defects via Railflow automation and much more.

Jenkins Plugin

Plugin approach

Railflow for ALM Jenkins plugin is a commercial product. As such, it is not available in the Jenkins plugin directory. Railflow for ALM Jenkins plugin (hpi file) can be downloaded from the website's download section.

Prerequisites

  • Jenkins version 2.332.1 or newer

Installation

  1. Download Railflow for ALM Jenkins Plugin
  2. Deploy the plugin via Manage Jenkins Manage Plugins Advanced Settings Deploy Plugin

Jenkins plugin installation 3. Click on the Deploy button and restart Jenkins for the plugin to take effect.

Configuration

To configure plugin, navigate to Manage Jenkins Configure System page of the Jenkins UI and scroll down to the Railflow ALM Global Settings section:

Jenkins plugin config

Licensing

info

Railflow for ALM provides two license activation models. If your network allows outbound calls to our api endpoint, then option 1: License Key (online activation) will work. If you are unable to reach our api endpoint, pick option 2: License File (offline activation).

  1. License Key (online activation): Select License Key option and copy/paste the license key from your email and click Activate License

Jenkins plugin online activation

  1. License File (offline activation): If your Jenkins instance does not have outbound internet access, you may use this option to upload the license activation from your email. The license file has a .skm extension.

Jenkins plugin offline activation

ALM Instances Configuration

Railflow for ALM plugin configuration section allows you to centrally defined one or multiple ALM servers. Once configured, they can be easily referenced in the Jenkins jobs.

Jenkins plugin config

Freestyle Job Configuration

If you are using Jenkins UI based (freestyle job) jobs to run some test frameworks/tools, you can use the Railflow for ALM plugin's UI controls to easily integrate with ALM by following these steps.

Add and configure the Jenkins job's post-build action: Railflow Plugin: ALM Test Results Processor. Railflow's post-build action allows you to specify the test framework, test results location, and various other ALM-related configurations.

Job config

Post-Build Action Reference

Both the Pipeline and Freestyle job depend on the Railflow Plugin: ALM Test Results Processor post-build action to process test results and post them to ALM. This action provides users a host of options to integrate Jenkins with ALM in a variety of ways and across any testing tool and framework. The reference below describes all the options and their usage.

tip

You can add multiple Railflow post-build actions using Add More button. This may be needed if you have multiple reports to process and want to map each report to different places in ALM.

KeyDescription
ALM Server Instance(required) The name of the corresponding ALM Instance in the global configuration
ALM Domain Name(required) The name of the ALM domain
ALM Project Name(required) The name of the ALM project
Fail build if upload unsuccessfulIf checked, the build will be marked as failed if for any reason the plugin could not upload the results. This could be due to Railflow issues, ALM issues, network issues, etc.
ALM UsernameIf specified, it overrides ALM username defined in Global Configuration
ALM PasswordIf specified, it overrides ALM password defined in Global Configuration
Results File Pattern(required) The file path to the test report file(s) generated during the build. Ant-style patterns such as **/surefire-reports/*.xml can be used.
E.g. use target/surefire-reports/*.xml to capture all XML files in target/surefire-reports directory.
Test Report Format(required) Results file format
Test Plan Path(required) Path to a Test Plan folder where test results should be exported to. If it does not exist, Railflow will create it automatically
Test Lab Path(required) Path to a Test Lab folder where test set should be created. If it does not exist, Railflow will create it automatically
Test Set(required) Name of a test set in ALM Test Lab where test results will be exported. If it does not exist, Railflow will create it automatically
Test Fields(optional) Values for Test fields in ALM Test Plan can be specified in this field. The format is [Test field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Field One=foo
Custom Field Two=bar
Test Set Fields(optional) Values for Test Set fields in ALM Test Lab can be specified in this field. The format is [Test set field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Set Field One=foo
Custom Set Field Two=bar
Run Fields(optional) Values for Run fields in ALM Test Lab can be specified in this field. The format is [Run field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Run Field One=foo
Custom Run Field Two=bar
Design Step Fields(optional) Values for Design Step fields in ALM Test Plan can be specified in this field. The format is [Design step field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Step Field One=foo
Custom Step Field Two=bar
Run Step Fields(optional) Values for Run Step fields in ALM Test Lab can be specified in this field. The format is [Run step field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Step Field One=foo
Custom Step Field Two=bar
Test Instance Fields(optional) Values for Test Instance fields in ALM Test Lab can be specified in this field. The format is [Test instance field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Instance Field One=foo
Custom Instance Field Two=bar
Upload Mode
Railflow Upload mode:
  • Full:
    Update entities in ALM TestPlan and ALM TestLab modules
    Value for pipeline: FULL
  • TestPlan Only:
    Update entities in ALM TestPlan only and do not upload results into ALM TestLab
    Value for pipeline: TEST_PLAN
  • TestLab Only:
    Update results in ALM TestLab and do not create/update entities in ALM TestPlan
    Value for pipeline: TEST_LAB
Disable GroupingDisabling Grouping will ignore report test structure and upload all test cases into a single ALM TestPlan folder as defined in the Test Plan Path.
ALM Auto Defect ManagementWhether Railflow ALM Auto Defect Management feature is enabled or not
Defect Create Policy
Defect creation policy:
  • None:
    Defects will not be created for failing tests
    Value for pipeline: NONE
  • Create:
    Create a new defect for failing test or updates the existing one which status is New, Open or Reopen
    Value for pipeline: CREATE
  • Reopen:
    Create a new defect for failing test or reopens the existing one
    Value for pipeline: REOPEN
Create StatusStatus in ALM which will be assigned to a newly created defect
Create Defect FieldsValues for fields of a newly created defect. The format is [Defect field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Defect Field One=foo
Custom Defect Field Two=bar
Reopen StatusStatus in ALM which will be assigned to a reopened defect. Effective only if create policy is Reopen
Reopen Defect FieldsValues for fields of a reopened defect. Effective only if create policy is Reopen. The format is [Defect field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Defect Field One=foo
Custom Defect Field Two=bar
SeverityValue for Severity property of a defect
Resolve Policy
Defect resolving policy:
  • None:
    Defects will not be closed when corresponding tests pass
    Value for pipeline: NONE
  • Close:
    Defects will be closed when corresponding tests pass
    Value for pipeline: CLOSE
Resolve StatusStatus in ALM which will be assigned to a resolved defect
Resolve Defect FieldsValues for fields of a resolved defect (being set when defect is being resolved). The format is [Defect field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Defect Field One=foo
Custom Defect Field Two=bar
Debug LogIf checked, Railflow for ALM will create .railflow-alm.log file in the workspace root folder

Pipeline Job Configuration

If you are using Jenkins Pipelines to run some test frameworks/tools, you can access the same plugin functionality within the Jenkinsfile:

pipeline {
agent {
label "linux"
}
stages {
stage('Build') {
steps {
echo '********BUILD STEP**********'
git branch: 'master', credentialsId: '*****', url: 'https://...junit-demo.git'
sh 'mvn test'
}
}
}
post {
always {
echo '********UPLOAD RESULT INTO ALM**********'

railflowAlm (
almServerName: 'ALM 15',
domain: 'DEFAULT',
project: 'demo',
overriddenUserName: 'user',
overriddenPassword: 'password',
debugLogEnabled: true,
failIfUploadFailed: true,
uploadConfigurations: [[
resultFilePattern: '**/target/surefire-reports/*.xml',
reportFormat: 'JUNIT',
testPlanPath: 'Subject\\Test Plan Folder',
testLabPath: 'Root\\Test Lab Folder',
testSetName: 'Test Set',
testSetFields: 'Test set field = set field',
designStepFields: 'Design step field = design step value',
disableGrouping: true,
runFields: 'Run field = run field value',
runStepFields: 'Run step field = run step value',
testFields: '''Test field 1 = test 1
Test field 2 = test 2''',
testInstanceFields: 'Instance field = instance value',
uploadMode: 'FULL',
defectHandlingConfiguration: [
createFields: 'Defect field = created',
createPolicy: 'REOPEN',
createStatus: 'New',
reopenFields: 'Defect field = reopened',
reopenStatus: 'Reopen',
resolveFields: 'Defect field = fixed',
resolvePolicy: 'CLOSE',
resolveStatus: 'Fixed',
severity: '2-Medium']
]])
}
}
}

railflowAlm parameters

KeyDescription
almServerName(required) The name of the corresponding ALM Instance in the global configuration
domain(required) The name of the ALM domain
project(required) The name of the ALM project
overriddenUserNameIf specified, it overrides ALM username defined in Global Configuration
overriddenPasswordIf specified, it overrides ALM password defined in Global Configuration
failIfUploadFailedIf checked, the build will be marked as failed if for any reason the plugin could not upload the results. This could be due to Railflow issues, ALM issues, network issues, etc.
debugLogEnabledIf true, Railflow for ALM will create .railflow-alm.log file in the workspace root folder

uploadConfigurations parameters

KeyDescription
resultFilePattern(required) The file path to the test report file(s) generated during the build. Ant-style patterns such as **/surefire-reports/*.xml can be used.
E.g. use target/surefire-reports/*.xml to capture all XML files in target/surefire-reports directory.
reportFormat(required) Results file format, available values:
  • JUNIT
  • NUNIT
  • TESTNG
  • TESTNG_STEPS
  • CUCUMBER
  • SERENITY
  • JBEHAVE
  • ALLURE
  • UFT
testPlanPath(required) Path to a Test Plan folder where test results should be exported to. If it does not exist, Railflow will create it automatically
testLabPath(required) Path to a Test Lab folder where test set should be created. If it does not exist, Railflow will create it automatically
testSetName(required) Name of a test set in ALM Test Lab where test results will be exported. If it does not exist, Railflow will create it automatically
testFields(optional) Values for Test fields in ALM Test Plan can be specified in this field. The format is [Test field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Field One=foo
Custom Field Two=bar
testSetFields(optional) Values for Test Set fields in ALM Test Lab can be specified in this field. The format is [Test set field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Set Field One=foo
Custom Set Field Two=bar
runFields(optional) Values for Run fields in ALM Test Lab can be specified in this field. The format is [Run field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Run Field One=foo
Custom Run Field Two=bar
designStepFields(optional) Values for Design Step fields in ALM Test Plan can be specified in this field. The format is [Design step field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Step Field One=foo
Custom Step Field Two=bar
runStepFields(optional) Values for Run Step fields in ALM Test Lab can be specified in this field. The format is [Run step field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Step Field One=foo
Custom Step Field Two=bar
testInstanceFields(optional) Values for Test Instance fields in ALM Test Lab can be specified in this field. The format is [Test instance field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Instance Field One=foo
Custom Instance Field Two=bar
uploadMode
Railflow Upload mode:
  • FULL:
    Update entities in ALM TestPlan and ALM TestLab modules
  • TEST_PLAN:
    Update entities in ALM TestPlan only and do not upload results into ALM TestLab
  • TEST_LAB:
    Update results in ALM TestLab and do not create/update entities in ALM TestPlan

defectHandlingConfiguration parameters

KeyDescription
createPolicy
Defect creation policy:
  • NONE:
    Defects will not be created for failing tests
  • CREATE:
    Create a new defect for failing test or updates the existing one which status is New, Open or Reopen
  • REOPEN:
    Create a new defect for failing test or reopens the existing one
createStatusStatus in ALM which will be assigned to a newly created defect
createFieldsValues for fields of a newly created defect. The format is [Defect field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Defect Field One=foo
Custom Defect Field Two=bar
reopenFieldsStatus in ALM which will be assigned to a reopened defect. Effective only if create policy is REOPEN
reopenFieldsValues for fields of a reopened defect. Effective only if create policy is REOPEN. The format is [Defect field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Defect Field One=foo
Custom Defect Field Two=bar
severityValue for Severity property of a defect
resolvePolicy
Defect resolving policy:
  • NONE:
    Defects will not be closed when corresponding tests pass
  • CLOSE:
    Defects will be closed when corresponding tests pass
resolveStatusStatus in ALM which will be assigned to a resolved defect
resolveFieldsValues for fields of a resolved defect (being set when defect is being resolved). The format is [Defect field label]=[value]. Each field name\value pair should start with the new line.
E.g.:
Custom Defect Field One=foo
Custom Defect Field Two=bar

ALM Export Details

Railflow creates a very rich and flexible integration between Jenkins and Micro Focus ALM. Based on Railflow configuration, ALM entities can be created or updated automatically as part of your CICD process.

Jenkins console output

Jenkins plugin

Automatic TestPlan Entries Creation

ALM TestPlan Results

ALM TestPlan Results

Automatic Test Set and Test Run Creation

ALM TestPlan Results

ALM TestPlan Results

Automatic Defect Creation

ALM Results