GitHub Action
LoadRunner Cloud
v1.0.11
Latest version
Use this action to run a load test in LoadRunner Cloud and collect reports.
The action can be used on both self-hosted and GitHub-hosted runners.
For security practices about using GitHub Actions, refer to GitHub's Security hardening for GitHub Actions.
If you use self-hosted runners, refer to the Hardening for self-hosted runners.
- Get your client id and secret key in LoadRunner Cloud. Refer to API access keys
- Store the client id and secret key in GitHub Secrets.
For example:LRC_CLIENT_ID
andLRC_CLIENT_SECRET
. These two secret names are used in following examples. - Prepare a load test in LoadRunner Cloud.
Input | Description |
---|---|
lrc_server | LRC URL, default: https://loadrunner-cloud.saas.microfocus.com |
lrc_tenant | Tenant ID, for example: 652261341 |
lrc_project | Project ID, default: 1 |
lrc_test_id | Test ID |
lrc_output_dir | The directory in which to save results. The path can be used in the "Upload artifacts" step. |
lrc_report_types | Target report types. For example: pdf, docx, csv . There are 3 supported report types: pdf, docx, csv. Leave this field empty if you do not need reports. Note: when test run is completed, a JUnit xml file will be generated in the results directory. |
Output | Description |
---|---|
lrc_run_id | The ID of test run started by this action. |
Trigger a load test at a scheduled time via GitHub schedule events
on:
schedule:
# run at 05:00 on every Friday
- cron: '0 5 * * 5'
jobs:
load_test:
runs-on: self-hosted
name: Start a load test
steps:
- name: Run test in LoadRunner Cloud
uses: MicroFocus/lrc-gh-action@v1
id: lrc_run_test
env:
LRC_CLIENT_ID: ${{secrets.LRC_CLIENT_ID}}
LRC_CLIENT_SECRET: ${{secrets.LRC_CLIENT_SECRET}}
with:
lrc_server: 'https://loadrunner-cloud.saas.microfocus.com'
lrc_tenant: '123456789'
lrc_project: '1'
lrc_test_id: '123'
Start a load test via a manually triggered workflow and upload the results to GitHub Artifacts
on:
workflow_dispatch:
inputs:
lrc_server:
description: 'LRC URL'
required: true
default: 'https://loadrunner-cloud.saas.microfocus.com'
lrc_tenant:
description: 'Tenant ID'
required: true
lrc_project:
description: 'Project ID'
required: true
default: '1'
lrc_test_id:
description: 'Test ID'
required: true
lrc_output_dir:
description: 'The directory to save results'
required: false
default: './lrc_report'
lrc_report_types:
description: 'Target report types. For example: pdf, docx, csv'
required: false
default: ''
jobs:
start_load_test:
runs-on: self-hosted
name: Start a load test
steps:
- name: Run test in LoadRunner Cloud
uses: MicroFocus/lrc-gh-action@v1
id: lrc_run_test
env:
LRC_CLIENT_ID: ${{secrets.LRC_CLIENT_ID}}
LRC_CLIENT_SECRET: ${{secrets.LRC_CLIENT_SECRET}}
with:
lrc_server: ${{ github.event.inputs.lrc_server }}
lrc_tenant: ${{ github.event.inputs.lrc_tenant }}
lrc_project: ${{ github.event.inputs.lrc_project }}
lrc_test_id: ${{ github.event.inputs.lrc_test_id }}
lrc_output_dir: ${{ github.event.inputs.lrc_output_dir }}
lrc_report_types: ${{ github.event.inputs.lrc_report_types }}
- name: Print test run ID
run: echo "LRC Run ID is ${{ steps.lrc_run_test.outputs.lrc_run_id }}"
- name: Upload LRC results
uses: actions/upload-artifact@v3
with:
name: lrc-report-${{ steps.lrc_run_test.outputs.lrc_run_id }}
path: ${{ github.event.inputs.lrc_output_dir }}
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- uses: actions/[email protected]
with:
node-version: '16.x'
- name: npm build
run: npm install && npm run build
# omit azure login, docker build process ...
- uses: 'azure/aci-deploy@v1'
with:
image: 'sampleapp:${{ github.event.release.tag_name }}'
# ...
load_test:
needs: build
runs-on: self-hosted
name: Start a load test
steps:
- name: Run test in LoadRunner Cloud
uses: MicroFocus/lrc-gh-action@v1
id: lrc_run_test
env:
LRC_CLIENT_ID: ${{secrets.LRC_CLIENT_ID}}
LRC_CLIENT_SECRET: ${{secrets.LRC_CLIENT_SECRET}}
with:
lrc_server: 'https://loadrunner-cloud.saas.microfocus.com'
lrc_tenant: '123456789'
lrc_project: '1'
lrc_test_id: '123'
Use reusable workflow provided in .github/workflows/lrc.yml
on:
workflow_dispatch:
jobs:
run_test:
# replace the commit hash with latest
uses: MicroFocus/lrc-gh-action/.github/workflows/lrc.yml@4733debb55362aa3d57115e566503481ddcf9a03
with:
lrc_server: 'https://loadrunner-cloud.saas.microfocus.com'
lrc_tenant: '123456789'
lrc_project: '1'
lrc_test_id: '123'
secrets:
LRC_CLIENT_ID: ${{ secrets.LRC_CLIENT_ID }}
LRC_CLIENT_SECRET: ${{ secrets.LRC_CLIENT_SECRET }}
print_run_id:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: run_test
steps:
- run: echo "LRC Run ID is ${{ needs.run_test.outputs.lrc_run_id }}"