Adding JavaScript functions to LoadRunner

After reading Boris Kozorovitzky’s blog article, “How to use JavaScript in your HP LoadRunner scripts”, I’ve been inspired to experiment with LoadRunner 12.

Historically, most LoadRunner functions have been written in C but many performance testers (me included) aren’t particularly fond of C and prefer to use more up to date languages. I was already aware that there are some great JavaScript libraries out there which can extend the functionality of LoadRunner, but I hadn’t tried them until now.

Boris’ article describes how to integrate JavaScript code into your C-based scripts. Following his guidance I developed a script which uses the DateJS function for date calculations. I’m impressed with the flexibility of DateJS and the extra capabilities that it offers over the standard LoadRunner date/time functions.

To incorporate the DateJS functionality into my script I did the following:

  • Turned on the “Enable running JavaScript code” function.
    Run-Time Settings > Internet Protocol > Preferences > Set advanced options > Options
  • Added my date.js code into the script using Solution Explorer.
    Right-click “Extra Files”node in Solution Explorer
    then choosing the option to “Add files to script”
  • Adding JS functions to the script is then achieved by using the LoadRunner web_js_run function.

    e.g.

    JavaScript example in LoadRunner
    JavaScript example in LoadRunner

I added my sample script to my GitHub repository so that other people can see just how easy this is and potentially benefit from the new date/time functions in this sample LoadRunner script.

You can download the script here: https://github.com/richardbishop/LoadRunnerSamples/tree/master/DateJS


Imitation is the sincerest form of flattery

Plagiarism
Plagiarism

I’ve heard this phrase before, but it’s never applied to me until now. This afternoon I was searching for a snippet of LoadRunner information when I came across a LoadRunner blog that I hadn’t seen before. I read a couple of articles when one in particular caught my eye. The website http://easyloadrunner.blogspot.co.uk by Raviteja Gorentla had one article in particular that interested me.

Article 1
The article “New Release of LoadRunner 12 version” describes in detail how the author met HP at the Discover conference in Barcelona and worked with them on the beta evaluation before it was released. This all sounded very familiar, so I looked at my own article, “First Look at LoadRunner 12” on the Trust IV blog. The text was identical. The plagiarist hadn’t even had the decency to cite the original author (me) or include a link to the Trust IV website.

Article 2
I did a quick trawl of the plagiarist’s website and found numerous other articles, some of which seemed familiar. For example “How to use JavaScript in your HP LoadRunner scripts” is a straight copy of Malcolm Isaac’s article from the HP LoadRunner and Performance Center blog.

Article 3
I looked a little further and the article “Sequential Random Unique Each iteration, Each occurrence in Load Runner” was taken from Sindu Bindu’s website and the article entitled “LOADRUNNER VUGEN PARAMETERIZATION” (http://www.sindubindu.com/2012/04/loadrunner-vugen-parameterization.html – Link no longer available). Even the images were taken from the original article because the screenshots showed a distinctive purple colour on the task bar.

Article 4
The next page that I looked at was “Action files in LoadRunner”, a very short article, describing the purpose of the three commonly used sections in a LoadRunner script. This also looked as if it had been copied from Sindu Bindu’s website. “Action files in Loadrunner” (http://www.sindubindu.com/2012/03/action-files-in-loadrunner.html – Link no longer available).  This same content was also duplicated on three separate scribd pages.

So far all the articles that I’d seen had been taken from other people’s websites. No original source or author was ever cited, but Raviteja had thoughtfully put a copyright statement at the bottom of his pages to protect ‘his’ content from people like him.

Sadly Raviteja’s efforts were in vain. Three other “copy cats” appeared to have reproduced his content on their scribd pages. The “Action Files in LoadRunner” document is also reproduced in:

So now you know why it’s so hard to “Google” for the correct answer to a performance testing problem. Unscrupulous testers are ripping off other people’s content and passing it off as their own. Next time you hire a big offshore provider, try to make sure that you don’t get Ravita, Janede, Sai or Ilaaaannnn working for you. I’m not sure that they know what they’re doing.

What’s new in LoadRunner 12?

LoadRunner 12

The roadmap for LoadRunner 12 was presented at HP Discover Barcelona in December last year. Since that time, I’ve been lucky enough to have a beta copy of LR12 for evaluation purposes. Now that the product has been released, I’m able to share some of the new features that I’ve found to a wider audience.

Key observations / new features are:

Cloud-based load generators. HP describes this feature as “cloud bursting”. Users now have the ability to provision load generators on AWS (Amazon Web Service) cloud servers from within LoadRunner or Performance Center. As well as this, the ports used to communicate between LoadRunner components such as Load Generators, Controllers, MI Listeners are user configurable through the new “network security manager” tool. This simplifies the setup process and allows more flexibility in distributed test networks or cloud-based test environments.  It is even possible to configure different ports/proxies for each Load Generator.

Licensing – 50 vUsers free
We in the user community have been asking for this for a long time. Providing fully-functional applications that allow small-scale testing allow prolonged evaluations and proof-of-concept exercises. This is great, because it allows more people e.g. developers to get hands-on experience and see the potential benefits of using LoadRunner.

This is likely to improve the adoption rate for LoadRunner and prevent the erosion of market share to low-cost / no-cost providers of performance testing software.

All protocols are included in the “community edition” license, with the exception of GUI (UFT) and COM/DCOM protocols as well as those protocols in the “template” bundle (i.e. those vUser types whose scripts are manually created (rather than record/replay) such as C# .Net, VB .Net vUsers).

VUGEN improvements
There are a variety of improvements as you would expect. Key ones are:

  • The ability to review replay statistics for tests after each run.
    Including details on total connections, disconnections and bytes downloaded.
  • The ability to edit common file types in the editor.
  • Support for recording in the Internet Explorer 11, Chrome v30 and Firefox v23 browsers.
  • The ability to create scripts from Wireshark or Fiddler files.
  • The ability to record HTML5 or SPDY protocols.

 

TruClient improvements
TruClient script converter. This basically replays your TruClient scripts and records the HTTP/HTML traffic allowing you to create these script typers from TruClient recordings. This is similar to recording GUI scripts and then converting to other script types.

The addition of support for Rendezvous points, IP spoofing, VTS2 and Shunra network virtualisation in TruClient scripts.

Linux Load Generator improvements
Building on the increased support for Linux Load Generators in 11.5x, LDAP, DNS, FTP, IMAP, ODBC, POP3, SMTP and Windows Sockets scripts can now be replayed through UNIX load generators.

CI/CD support
Better integration with Jenkins etc.

Platform support

  • Support for installation on Windows Server 2012.
    (LoadRunner 11.x and PC 11.x only supported up to W2K8 which was a barrier to enterprise adoption).
  • LoadRunner components can now run in a “non-admin” user account with UAC and DEP enabled.

There are numerous other improvements which are well documented in the “About LoadRunner” section in LoadRunner help. Now that the community license is available, there’s nothing stopping you from downloading it and giving it a go.

To get your own copy, navigate to www.hp.com/go/loadrunner  and follow thre links to download LoadRunner.

– reproduced from my Trust IV blog article at:
http://blog.trustiv.co.uk/2014/03/first-look-loadrunner-12#sthash.pmwREa11.dpuf