Using LoadRunner / Performance Center to kill a rogue process

I recently saw a question in a discussion forum for LoadRunner and after replying with a potential solution for a friend of mine, I thought that I’d share my solution here as well. My friend was testing using a Citrix client and when the script failed, the Citrix client was left running. This meant that subsequent test iterations would all fail as well.

Testers using other thick clients such as SAPGUI, RDP, TruClient (using Firefox or Chrome), QTP or UFT may also face this issue.

One way to resolve the problem of orphaned process such as this would be to use a command line function to kill the offending process when an error is detected. In the example below, the script kills any instance of the “calc.exe” (calculator) process. You should replace “calc.exe” with the name of the executable / rogue process.






N.B. You need to be extremely careful with this code (for obvious reasons).

Monitoring Ubuntu Linux from LoadRunner (RSTAT)

Over the years I’ve used RSTAT to monitor the performance of Linux servers during performance tests many times. Historically I’ve asked Linux admins to enable RSTAT for me but over the last year or two I’ve incorporated various Linux machines into my test and demo environment so I’ve had to do this myself.

I’m primarily a Microsoft specialist so I always seem to rely on Google searches and some trial and error to resolve problems that I encounter with Linux and this weekend was no exception. I spotted a FaceBook post from Scott Moore describing problems that he was having with LoadRunner and RSTAT so I decided to see if I could help him.


I installed RSTAT on my Ubuntu test machine at home and immediately saw the dreaded error message “Error while creating the RPC client. Ensure that the machine can be connected and that it runs the rstat daemon (use rpcinfo utility for this verification).”

Whatever I tried, I could’t get RSTAT to start. After some ‘Googling’, I found a number of posts in various places which helped me to resolve this problem.

A post on StackExchange (related to NFS issues) told me that rpcbind may have a dependency on a package called nfs-common. I installed this “just in case”. The same post told me that to start STATD (which I think is related to RSTAT) automatically at boot, I needed to add “NEED_STATD=yes” to the file “/etc/default/nfs-common”.

A  post on told me that I should edit my /etc/hosts.allow file to ensure that the local host could make rstatd requests.

After restarting my Ubuntu PC, I checked that RSTATD was running using the commands “rsysinfo localhost” and “rup localhost”. I was pleased to see that after making these changes, it was possible to monitor my Ubuntu machine using LoadRunner.



I repeated my test on a new Ubuntu 16.04 LTS machine which I monitored using LoadRunner 12.53. A list of the commands that I used is below:

Install rstatd and related components:

sudo apt-get install rstatd rstat-client nfs-common

Add a line to /etc/hosts.allow to allow certain hosts to make rstatd requests:

rpc.rstatd: localhost

Added a line to /etc/default/nfs-common to start STATD automatically:


These commands confirm that RSTATD is running:

rpcinfo -p localhost 
rsysinfo localhost
rup localhost

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.


    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:

This article originally published on the Trust IV blog.