Performance Testing @ the Frontline

A hidden world where small things make a big difference

LoadRunner and its non-standard SMTP implementation

Posted by Kim on Sunday, January 10, 2010

In one of my recent assignments I was asked to investigate how the SMTP vuser type behaves in LoadRunner. The need was to send alot of EMail messages to a SMTP server, and specifically the CC and BCC fields where important.

As it turns out the SMTP implementation in LoadRunner (v8.1 and v9.5x) does not quite follow the standard when it comes to the CC and BCC headers.To actually test the SMTP script I first had to get myself a SMTP Dummy server (so I could send something somewhere) and after evaluating several free ones, I decided to write my own. The main reason was that now I had control over the server end too making debugging much easier.

So to test the SMTP Client implementation I took the code from the LR help file and modified it slightly to suit my needs.

Action()
{
 // Connect to MailServer
 smtp_logon("Logon",
 "URL=smtp://testuser@192.168.0.100:28100",
 "CommonName=Smtp Test User 0001",
 LAST );

 // Send an EMail
 smtp_send_mail("SendMail",
 "To=TO@domain.com",
 "Cc=CC@domain.com",
 "Bcc=BCC@domain.com",
 "From=lr@domain.com",
 "Subject=Testing SMTP From LR",
 "ContentType=text/plain;",
 "charset=UTF-8",
 MAILOPTIONS,
 "X-Priority: 3",
 "X-MSMail-Priority: Normal",
 "X-Mailer: Microsoft Outlook Express 5.00.2919.6700",
 "X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700",
 MAILDATA,
 "MessageText=This is a simple mail from LR\r\n",
 LAST );

 // Wait a sec
 lr_think_time(1);

 // Disconnect from Server
 smtp_logout();

 return 0;
}

Too see what was really going on at the protocol level I used WireShark to capture the traffic to my dummy server:

220 Celarius Dummy SMTP Server v1.0 Beta
EHLO CliMachine
250-Hello CliMachine
250-ENHANCEDSTATUSCODES
250-SIZE 0
250-CHUNKING
250-8BITMIME
250 BINARYMIME
MAIL FROM: lr@domain.com
250 2.1.0 lr@domain.com Address Okay
RCPT TO: <TO@domain.com>
250 2.1.5 TO@domain.com Address Okay
RCPT TO: <CC@domain.com>
250 2.1.5 CC@domain.com Address Okay
RCPT TO: <BCC@domain.com>
250 2.1.5 BCC@domain.com Address Okay
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Message-ID: <00004b49b60c$00000001$01401408@192.168.0.100>
From: "Smtp Test User 0001"
Date: Sun, 10 Jan 2010 13:12:12 +02:00
Subject: Testing SMTP From LR
MIME-Version: 1.0
Content-Type:text/plain;charset=UTF-8
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6700
X-MieOLE: Produced By Microsoft MimeOLE V5.00.2919.6700

This is a simple mail from LR

.
250 Ok
QUIT
221 Signing Off

Now from the raw log I can clearly see that all the recipients email addresses are sent using the RCPT TO command, but the actual mail-headers do not contain the TO, CC or BCC headers as expected. This will in effect render the built-in SMTP implementation totally useless for any serious testing of a mail server.

The only way I could get the headers to appear in the email-headers was to manually add them in the MAILOPTIONS part, thus making my code more complicated.

The other solution I came up with was to create a SMTPClient.DLL extension, that implements the SMTP protocol correctly, and also gives me the possibility to test SSL or TLS authenticated servers, but that is another story that I might blog about in the future…

Advertisements

2 Responses to “LoadRunner and its non-standard SMTP implementation”

  1. […] LoadRunner and its non-standard SMTP implementation « Performance … […]

  2. […] LoadRunner and its non-standard SMTP implementation « Performance … […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: