How many vUsers ran in a test?

Recently a colleague of mine working at a major UK bank was asked to find out ways that the number of vUsers in a test could be recorded so that the cost of LoadRunner licences could be charged back to the project or department who requested a particular test. I had a quick look arounf the LoadRunner results set and found a file containing information which can be used to calculate this.

In the results folder there is a sub-folder called “Data”. This contains a file called vurun.txt.
The file contains information about the vUser profile for a test.

A sample file looks like this…..

1296043739         0              1296043742

1296043742         1              1296043745

1296043745         2              1296043748

1296043748         4              1296043751

1296043751         2              1296043753

1296043753         1              1296043756

1296043756         0              1296043759

 

The first number in each row is the epoch time (in seconds).
The second number in each row is the number of running vUsers.
The third number in each row is also epoch time.

Each row basically contains 3-seconds-worth of information. (I presume that this is the default sampling interval).

In the example above (which I’ve made up), the test started and no users ran in the first 3 seconds. The vUser count was 1 in the next 3-second period, 2 in the one after that etc. You could either calculate an average from the middle column to charge per vUser or pull out the largest number and charge based on that.

The contents of this file can be pasted into an Excel spreadsheet and the “text to columns” option can be used to split the information in the file into three columns.
The LoadRunner AVERAGE and MAX functions can be used to return the average or maximum number of running users.

You can use tools such ashttp://www.epochconverter.com/ or http://bish.co.uk/epoch.htm to convert the epoch times in the file to the Gregorian calendar.

Using LoadRunner to send an email

I recently read a question on a LoadRunner user forum (http://osdir.com/ml/LR-LoadRunner/2010-08/msg00072.html) asking whether it was possible to get Loadrunner to send an email.

I started thinking how useful this could be, for example, my DBA always wants to know when a test finishes so he can restore the database on the test system. He often asks me to ring him when a test finishes. This is fine, but can be a nuisance when running a long test, for example over a weekend or evening.
Wouldn’t it be good if we could use LoadRunner to send an email when the scenario finishes?

I played around with an old DOS command line email program (BLAT).
BLAT can be downloaded here.
http://sourceforge.net/projects/blat/files/

Install BLAT into c:\blat and create a file containing your message body called Test.txt.

This command can then be used to send an email.

c:\blat\blat.exe c:\blatTest.txt -subject "Test Complete" -to [email protected] -server mailserver.domain.com -f [email protected] -iu username -ipw password

The sample script in my GitHub repository will email the contents of a file with the subject line “Test Complete”. It is also possible to send email attachments using the -attach switch.

https://github.com/richardbishop/LoadRunnerSamples/tree/master/SendMail

 

LoadRunner syntax highlighting with GeSHi

Last week I can across this article by Stuart Moncrieff who looks after the myloadtest.com website.
http://www.myloadtest.com/loadrunner-syntax-highlighter/

In this article Stuart describes how he wrote a php file for GeSHi (Generic Syntax Highlighter) which highlights LoadRunner C code using the same colours as vuser generator. This has been something that I’ve wanted for ages. Whenever I do documentation describing a script, I often want to paste it into my Word document, PDF or website using the same colours as LoadRunner.

Once Stuart wrote the syntax file, I decided to give it a go. I installed it on my site and modified the sample GesHi page so that LoadRunner was the default language type. It took no time at all thanks to the good documentation provided by Stuart and the developers of GeSHi.

 

The finished results can be seen here – http://bish.co.uk/geshi/example.php
Simply paste your LoadRunner code into the empty text box and click “submit”, GeSHi does the rest for you.
If you wanted to, you could choose a different language from the drop-down list to format the code in colours relevant to a different programming language such as COBOL, delphi, java, html, php or the other languages supported by GeSHi.

Sample output:
GeSHi screenshot