LoadRunner and Performance Center Blog
cancel

How to Integrate LoadRunner with Jenkins CI

How to Integrate LoadRunner with Jenkins CI

Micro Focus Expert

This post was written by Daniel Gront from Performance Protocols teamGrontD.png

 

 

 

 

The Application Automation Tools plugin for the Jenkins continuous integration server provides a mechanism for executing LoadRunner Controller scenarios as part of a build script. This plugin allows you to trigger a performance test as a build step and present the results in the Jenkins user interface.

You can only integrate scenarios which have service level agreements (SLAs). This allows you to quickly determine whether the test passed or failed and if performance was affected.

Schema.png

Prerequisites:

  1. Install Jenkins (we support only the five latest LTS versions, see here for list).
  2. Install the Jenkins Micro Focus Application Automation Tools plugin

 

There are two types of jobs that you can create: FreeStyle or Pipeline. FreeStyle is more UI friendly and Pipeline is in a form of code which is more flexible.

Set up a job

  1. Go to the Jenkins Server home page.
  2. Click the New Itemlink or select an existing job.
  3. Enter an item name (for a new job).

FreeStyle Jobfreestyle.png

 

  • Select Freestyle Projectand click OK.
  1. In the Project Configuration section, select Restrict where this project can be run, and select the appropriate node. For details, see Create an execution node.                                                                              restrict.png                                                                                                                                                                                                                                                                   
  2. Scroll down to the Build
  3. Expand the Add build stepdrop-down and select Execute Micro Focus tests from the file system.                 build.png          
  4. Click the LoadRunner-Specific Settingsbutton and specify the following settings:                                           specificsettings.png        
    • Controller Polling Interval.The interval in seconds by which to poll the Controller for the scenario status. The default is 30 seconds.
    • Scenario Execution Timeout. The total time in seconds to allow for the execution of all listed scenarios. After this time, the Controller process will be terminated.
    • Errors to Ignore.You can specify which errors to ignore during the run. For example Error: CPU usage for this load generator has exceeded 80%. Enter each error string on a separate line.
    • Analysis Template. Apply a template for the build (path to a .tem file). Leave blank in order to use the default template.
    • Display Controller. Display the controller while the scenario is running.                                                               
  5. In the Testsbox, enter a test with its full absolute path, or a folder or MTB containing one or more tests or LoadRunner scenarios. To specify multiple entries, click the down arrow on the right of the field and enter each test path on a separate line. Make sure that the paths are accessible from all machines in the local network.                                                                                                                                                                  exectetest.pngexectimeout.png                                                                                                                                                                                                
  6. Indicate a timeout in seconds after which the job will fail in the Timeoutbox (optional). 
  7. Click Applyto save your changes and continue with more build steps. Click Save when you are finished adding build steps.                                                                                                                                                  Apply.png         

Pipeline Job

  1. Select Pipelineand click OK.                                                                                                                                  pipeline.png         
  2. To restrict where this project can run, first see Create an execution node and then Controlling your build environment.
  3. Scroll down to the Pipeline
  4. Click Pipeline Syntax.                                                                                                                                              pipelinesyntax.png     
  5. In Sample Step, select loadRunnerTest: Run LoadRunner performance scenario tests                                     sample LR.png         
  6. In the Testsbox, enter a test with its full absolute path, or a folder or MTB containing one or more tests or LoadRunner scenarios. To specify multiple entries, click the down arrow on the right of the field and enter each test path on a separate line. Make sure that the paths are accessible from all machines in the local network
  7. In Report archive mode follow Set up the Post Build Actions
  8. Follow FreeStyle Job section, steps 5 to 8.
  9. Click Generate Pipeline Script.                                                                                                                               GeneratePS.png  
  10. Copy the output below the Generate Pipeline Script.
  11. Go back to the Pipeline
  12. Paste the copied code into the Script block (read here for how to write pipeline).
  13. Click Apply to save your changes and continue with more build steps. Click Save when you are finished adding build steps.                                                                                                                                                 Apply.png 

Set up the Post Build Actions

  1. In the Post-build Actionssection, expand the Add post-build action drop-down and select Publish test result.
  2. Select an archiving option for the test run results:
    • Archive test reports for failed tests: Only save test result reports for failed tests.
    • Always archive test reports:Always save test result reports.
    • Always archive and publish test reports:Always save and publish test result reports.
    • Do not archive test reports:Never save the test results.

Run the job

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

 

Review the results in the Run Results Viewer  

  1. Extract the files from the archive file. When you when you extract the zip file contents, it creates the following folders and files:
    • LRR folder- The Controller raw result folder, viewable in LoadRunner Analysis.
    • LRA folder- The Analysis session folder, viewable in LoadRunner Analysis.
    • HTML folder- HTML reports in two subfolders, IE and Netscape, in their respective formats.
    • xml- An XML report showing the status of the SLA in the test.
  2. Open the Run Results Viewer and select FileOpen.
  3. In the Open dialog box, select` Results XML fileand navigate to the xml file in the folder that you extracted.
  4. Click Openand view the results.

Note: The pass and fail criteria for LoadRunner scenario tests are based on the LoadRunner Service Level Agreement (SLA). If you do not define an SLA, the scenario will fail. For details, see the LoadRunner Help Center.


Review the results in Jenkins  

You can also view the results from the Jenkins interface, in the following modes:

  • Per job/project
  • Per build/run

Per Job / Project (cross build/run results)

Click Project performance report in the left side Job menu. This lets you review the various results from the job, per scenario. You compare the job results using an SLA.

Per build/run 

  1. Click Performance reportto examine the performance summary report with its different results.
  2. Click Transaction summaryto open a detailed view of the transactions statistics taken directly from LoadRunner Analysis report.
  3. Click Rich Reportto show a high-level report of the build run. (This requires you to enable Rich Reports in Analysis and generate a PDF. For details, see the Edit Template dialog box.
  4. Click Simple JUnit style SLA result
    1. Click on Test Result.
    2. Click on All tests to see the overview.
    3. Select a scenario by clicking on its name.
    4. Click on Historyin the left panel to compare the results with those from previous runs.

Note: These reports might require you to perform a Security header override. For details, see the Content Security Policy Header.

 

For additional information on the plugin checkout out the plugin’s wiki page, for any general questions go to our google group.

 

0 Kudos