Our legacy site: www.webwob.com   

VUgen scripting methods (page 3)

This page will cover more BASH scripting methods, following on from the legacy site pages.

     LoadRunner CI/CD      *_LR_CI_*      LR_CI_+      Email_out      Email_in      Cookies 1      TUTORIAL      sprintf      debug      VUgen      Kill -9      disk space      AWS S3      dig (DNS++)      substitute      curl with timings      LR_Jenkins_graphs     

    

Areas covered on this page

Quick LoadRunner results to graphs


Run a quick LR script in standalone mode and graph the results by checking the output log


Step 1. Windows batch (code given as text below):

Windows batch

  "C:\loadrunner\program\HP\loadrunner\bin\mmdrv.exe" -usr "Z:\github\PerformanceTesting\scripts\mint\mint_test_script1\mint_test_script1.usr"
  
  cp "Z:\github\PerformanceTesting\scripts\mint\mint_test_script1\output.txt" .
  
  
Step 2. Shell script (code given as text below):

Shell script
  
  grep -o "PASS: user login:" output.txt
  
  grep -o "PASS: user login:" output.txt | wc -l
  
  result=$(grep -o "PASS: user login:" output.txt | wc -l)
  echo "result = ${result}"
  
  if [ "$result" != "5" ]
  then
      echo TERMS test FAILED
  else
      echo TERMS test PASSED
  fi
  
  rm -f *.jtl
  
  #EXAMPLE JTL FILE:
  #<?xml version="1.0" encoding="UTF-8"?>
  #<testResults version="1.2">
  #<httpSample t="7789" ts="1495203777317" s="true" lb="eventTime" rc="200"/>
  #</testResults>
  
  now=$(date +%s)
  now=$(($now * 1000))
  
  echo '<?xml version="1.0" encoding="UTF-8"?>' > count.jtl
  echo '<testResults version="1.2">' >> count.jtl
  echo -n '<httpSample t="' >> count.jtl
  echo -n "${result}" >> count.jtl
  echo -n '" ts="' >> count.jtl
  echo -n ${now} >> count.jtl
    
Note: on the next line you might want to adjust the pass/fail in the jtl file, depending on the results

  echo '" s="true" lb="eventTime" rc="200"/>' >> count.jtl
  echo '</testResults>' >> count.jtl
  
  
Step 3. Groovy Post Build (code given as text below - Don't need the first line!):

Shell script

  if(manager.logContains(".*TERMS test PASSED.*"))
  {
      manager.listener.logger.println("Groovy setting build to PASSED")
      manager.build.@result = hudson.model.Result.SUCCESS
  }
  else
  {
      manager.listener.logger.println("Groovy setting build to FAILED")
      manager.build.@result = hudson.model.Result.FAILURE
  }
  
Step 4. Trend Graphs (code given as text below):

Trend graphs

  **/*.jtl
  5
  10
  
Results: (Quick example):

Resultant graphs

Last run failed (because the last count was 4 rather than the expected 5):

Resultant graphs