POC on continuous automation framework for running performance test using C1/CD pipeline by integrating Jenkin and Loadrunner, wanted to share the details for the same -
Automation framework POC completed on integrating the performance testing tool (LoadRunner) with Jenkins, this POC was performed to implement continuous performance benchmarks
How it works Step by Step Guide -
- Setup the jenkins on one of the VMs
- On the same VM we have LoadRunner installed (Vugen, Controller and analysis)
- Once Jenkins URL up and running, add the inbuilt jenkins plugin - Micro Focus Application Automation Tools to integrate jenkins and LoadRunner
- Once the above plugin is installed, create Jnekins Job and add the build step to run the load runner scenario file
- Test configurations when calling loadrunner scenario are as below
- Add build step to execute custom batch script on the VM (same VM where Jenkins and Loadrunner configured), this batch script will take to collate result and put it into zip to send over email.
- Configuration to batch script looks as below -
- Batch script - prepareTheReportToSend_<>.bat
@echo off
set job_name=%~1
echo %job_name%
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%
set stamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%
for /f "delims=" %%a in ('dir C:\JenkinsSetup\workspaceDir\.jenkins\workspace\%job_name% /b /ad-h /od "Anoth*"') do set "latestDir=%%~a"
echo %latestDir%
echo C:\JenkinsSetup\workspaceDir\.jenkins\workspace\%job_name%\%latestDir%\HTML\IE
cd C:\JenkinsSetup\workspaceDir\.jenkins\workspace\%job_name%\%latestDir%\HTML\IE\
"C:\Program Files\7-Zip\7z.exe" a C:\JenkinsSetup\workspaceDir\.jenkins\workspace\%job_name%\Performance_Benchmark_Report.zip *
copy "C:\JenkinsSetup\workspaceDir\.jenkins\workspace\%job_name%\Performance_Benchmark_Report.zip" "C:\automation\LR_Results_Dir\archive\<>\Performance_Benchmark_Report_%latestDir%_%stamp%.zip"
cd C:\JenkinsSetup
- Once the Build step are configured, we also need to specify post build steps as below
- To publish Test result below is the step
- To send the results over email need to add Editable Email Notification step,
- Whatever the zip will create by batch script it will get delivered over email by this step.
- We are ready to trigger build and run test now
- Below are few configs, related to jenkins to send email -
- Once all Configs done trigger email, below is the console output for one of the test - ConsoleOutput.txt
Console Output
Started by user <username>
Running as SYSTEM
Building in workspace <workspace path>
No emails were triggered.
"Started..."
Run build tests
Launcher timeout is 10675199::02:48:05
Controller Polling Interval: 5 seconds
PerScenarioTimeout: 00::16:40:00 minutes
FileSystemTestRunner timeout is 10675199.02:48:05.4775807
UFT Mobile connection info is - UFT Mobile HostAddress: , Port: 8080, Username: , TenantId: , UseSSL: 0, UseProxy: 0, ProxyType: 0, ProxyAddress: , ProxyPort: 0, ProxyAuth: 0, ProxyUser:
1 tests found:
<lrs File path>_Scenario.lrs
============================================================================
18/10/2021 12:58:02 Running: <lrs File path>_Scenario.lrs
<lrs File path>.lrs
Cleaning up the environment...
Preparing scenario <lrs File path>_Scenario.lrs for execution.
Load Generator bus00gkh.us.oracle.com connected
setting scenario result folder to <lrr File path>\LRR
scenario result folder: <lrr File path>\94d3d7\LRR
Starting scenario...
Scenario run has started
Elapsed Time (D:H:M:S): 00:00:00:00
Down Pending Init Ready Run Rendez Passed Failed Error Exiting Stopped G_Exit
1 1 0 0 0 0 0 0 0 0 0 0
Error count: 0
Passed transactions: 0
Failed transactions: 0
Hits per second: 0
On Jenkins Server -
--- Hope it is useful. Thanks