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

Step 1: Use curl to get simple performance metrics

Step 2: Get the POST body from Fiddler ready for curl

Use curl to get simple performance metrics

Command line usage
curltime.bat "http://content-v1.core.perf.server.com/content-hubs-list.json"

  curl -w "@%~dp0curl-format.txt" -o NUL -s %*
[ or from cygwin use this directly:
curl -w "@curl-format.txt" -o /dev/null -s "http://my-request.json"

curl-format.txt: (download here: curl-format.txt)
  time_namelookup:  %{time_namelookup}\n
         time_connect:  %{time_connect}\n
      time_appconnect:  %{time_appconnect}\n
     time_pretransfer:  %{time_pretransfer}\n
        time_redirect:  %{time_redirect}\n
   time_starttransfer:  %{time_starttransfer}\n
           time_total:  %{time_total}\n
I am using cygwin on windows here, hence the use of curl inside a windows batch file!

I did get this technique in detail from here:

In practice:
I do have one issue in my case and I probably have to resort to JMeter here, just to make enough calls to get consistent numbers - I can't be sure how much of this variability is due to data caching and how much is due to data lookup and server lag etc. A proper JMeter test would allow us to run for longer and numbers settle down properly. This could be important for management reports etc. (to be fair, this call does bring back a lot of data)

Windows batch file:

cygwin BASH version:

This works for me as well, for rough timings of batch files etc:

  START=$(date +%s)
    # do something
    # Finished
  END=$(date +%s)
  DIFF=$(( $END - $START ))
  echo "It took $DIFF seconds"


Get the POST body from Fiddler ready for curl

Fiddler Request seen with all sorts of new lines etc.

curl format wanted:

BASH - FIRST STEP ONLY - to adjust Fiddler text output file for use with curl:
cat fiddler_request.txt | tr '\r' '^' | tr '\n' '!' > temp_tr"


The main thing I've tackled here is just to get the BODY ready for a web request to use in LoadRunner, based on a Fiddler trace. In fact it was tricky and I ended up using the development team's actual curl code they had for their own testing. The above code is my first step. The second step could well be done in LoadRunner itself, just doing a text replacement for ^! to \r\n IN FACT, I have tested the Vugen replacement successfully:

You can see here I have a VERY long input string, full off '^!' characters from the above BASH:   Screenshot

Use VuGen quick replace on ^! for \r\n   Screenshot

This works (see next screen shot as well):   Screenshot

AND this very long input string now looks just like the curl data used by the developers script:   Screenshot

One last step, which I will try and find the time to do, is to test this in earnest. I can't do this right now due to project time pressures, but it does look like it should work in earnest without issue.

LoadRunner VuGen script snippet (data input here taken from the developer's curl test script - for 'Body=')

      web_add_auto_header("Accept-Encoding", "gzip, deflate, br");
      web_add_auto_header("Accept-Language", "en-GB,en-US;q=0.8,en;q=0.6");
      web_add_auto_header("content-type", "multipart/form-data; boundary=----WebKitFormBoundary34BFrWfsVy3");
      web_add_auto_header("Accept", "*/*");
      web_add_auto_header("Cache-Control", "no-cache");
Content-Disposition: form-data; name=
Content-Disposition: form-data;