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.
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:\blatblat.exe c:\blatTest.txt -subject "Test Complete" -to [email protected] -server mailserver.domain.com -f [email protected] -iu username -ipw password
The attached script will email the contents of the file with the subject line “Test Complete”.
My blat folder can be dowloaded as a zip file from my discussion site.
With my recent work, developing a solution for a client who wants to use MySQL for LoadRunner parameters (instead of VTS) and for results logging, I’ve found it useful to be able to quickly copy the LoadRunner MySQL binaries and library (include) files onto a new LoadRunner PC or server quickly.
To acheive this, I’ve written a DOS batch file which checks to see whether LoadRunner is installed in a 64-bit or 32-bit operating system and installs the files to the relevant folder automatically.
You can download the batch file together with the MySQL library and binary files here.
IF EXIST “C:\Program Files\HP\LoadRunner” GOTO 32bit
IF EXIST “C:\Program Files (x86)\HP\LoadRunner” GOTO 64Bit
ELSE GOTO NoLR
XCOPY “bin*” “C:\Program Files (x86)\HP\LoadRunner\bin” /Y /R
XCOPY “include*” “C:\Program Files (x86)\HP\LoadRunner\include” /Y /R
XCOPY “bin*” “C:\Program Files\HP\LoadRunner\bin” /Y /R
XCOPY “include*” “C:\Program Files\HP\LoadRunner\include” /Y /R
ECHO “No LoadRunner folder found!”
ECHO “Check that LoadRunner isn’t installed in a non-standard folder”
When I worked at HBOS, I found that the standard database in LoadRunner Analysis (MS Access/Jet) didn’t perform very well with large results sets and I wrote an article (attached) describing how to install MSDE as an alternative database engine for LoadRunner Analysis 8.1.
Since 2007, technology has moved on apace and other, better databases are available. SQL Express is one such database and I found an article similar to mine, describing the same process to install SQL Express as the database engine for LoadRunner analysis. I’ve reproduced the article here (see the second attachment). In case the original source of this information disappears from the Internet.
Here’s the link to the original document on wperf.blogspot.com.
A PDF of my MSDE document can be downloaded here.
A PDF version of the SQL Express instructions can be downloaded here.
Last week I can across this article by Stuart Moncrieff who looks after the myloadtest.com website.
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.
In February 2010, I wrote a brief article, describing how MySQL could be used instead of VTS as a repository for test parameter data during performance tests. This has so far been the most popular article on this website and the associated MySQL LoadRunner libraries have been downloaded over 100 times.. Since February, together with John Howley, I’ve refined this technique and spent some time improving the documentation.
There are a number of reasons why I was keen to improve this technique.
- I needed a reliable, scalable alternative to VTS.
- I needed the ability to store results from multiple tests and compare them by using simple queries.
- I needed to be able to select test data at random from large tables yet still ensure that the record in use by one script couldn’t be used by another script.
I have described some of the benefits of using MySQL with LoadRunner in the sub-headings below, but if you want to dive right into the sample documentation and get started with a sample MySQL database you could always jump straight to the PDF document
. This document contains hyperlinks which allow you to download the sample scripts and includes a step-by-step guide to installing MySQL for use with LoadRunner.
Why use MySQL with LoadRunner?
- MySQL gives us the ability to provide LoadRunner with dynamic data (and possibly even change it during a test.).
- In a recent engagement, LoadRunner was having problems when using large parameter files, even on our large load generator and controller servers (Quad core Windows 2003 servers with 6GB RAM). Some paramaters were not evaluated properly and occasionally corrupt or partial strings were sent to the test system by LoadRunner.
- Script initialisation was taking a long time during script initialisation when the large parameter files were sent to the load generators by the controller. (Our Parameter files were often 30MB or more and our largest file was 258MB and contained more than three million rows.)
- LoadRunner summarises results and can display average response times at a minimum granularity of one second. Our client had a requirement to log all response times to determine whether poor performance in a one-second period was down to one very slow transaction or a number of slower than average transactions.
- It was necessary to be able to share detailed transaction information with the project developers. To help identify one transaction from many, we saved information to a MySQL results database. The records in this database contained the exact time of the transaction, details of the API under test, parameters used as well as information about the HTTP response code.
- We were asked to provide the ability to test multiple APIs either simultaneously or independently. The application which we were testing behaves differently for different client types and so we were asked to cater for this in our scripts. We wrote scripts which would read run-time information from MySQL and set the proportion of transactions of each type accordingly.
- In our scripts, we set the proportion of JSON/XML requests in a MySQL table and the LoadRunner scripts read this information at run-time and used the appropriate ratio when simulating client interactions with the test system. The test application was an online music application and using the same technique we could change the proportions of the search scripts so that they searched for artists/tracks/albums in the appropriate ratio.
Reporting and analysis
- Running queries against the MySQL results database gave us the ability to compare multiple tests with one another, which is not possible using LoadRunner Analysis.
- We were able to report on transaction response times at a level of detail which is not possible using LoadRunner Analysis.
- Tools such as XML/SWF charts by maani.us allow us to produce configurable results charts for our client. http://www.maani.us/xml_charts/
- Excel and Access can be used to provide detailed reports and charts based on our test results which can be easily reconfigured by the client to display the results that they’re interested in (drill-down).
||PDF document describing the technique in detail.
This contains sample LoadRunner code as well as instructions for configuring LoadRunner for use with MySQL. The document contains hyperlinks to the LoadRunner scripts below.
||Sample LoadRunner script which reads data from a MySQL parameter table.
||Sample LoadRunner script which reads a random line of data from a MySQL parameter table.
||Sample LoadRunner script which writes data to a MySQL results table