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

 

Author: Richard Bishop

http://about.me/richard_bishop