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

Setting timezone on PCs using a batch file

 

For some testing recently I had to reset all our test PCs to use UTC (GMT) instead of BST.
This meant that our LoadRunner log files and test results would tie-in with the log files on the UNIX systems which we were testing.
It’s worth noting that W3C log files (web server loig files) all use UTC time as well, so this is useful if you want to synchronise your times with the rest of the “non-Windows” world.
Use this command to set your timezone to UTC…. (tested on Windows XP and Windows 2003 server).
[code]RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z (GMT) Coordinated Universal Time[/code]

For some testing recently I had to reset all our test PCs to use UTC (GMT) instead of BST.

This meant that our LoadRunner log files and test results would tie-in with the log files on the UNIX systems which we were testing. It’s worth noting that W3C log files (web server loig files) all use UTC time as well, so this is useful if you want to synchronise your times with the rest of the “non-Windows” world.

 

Use this command to set your timezone to UTC…. (tested on Windows XP and Windows 2003 server).

RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z (GMT) Coordinated Universal Time