Performance Test DNS Servers using LoadRunner

If ever you need to use LoadRunner to test DNS servers, this is the script for you.

This virtual user script is designed to test hostname resolution against DNS servers. If a host address resolves to multiple addresses, all addresses are displayed in the output.   

N.B. DNS scripts use parameter delimiters rather than the more common {} delimiters.


 


#include “mic_socket.h”

 

Actions()

{

char *results = NULL;

int   rescnt  = 0;


lr_save_string(“10.190.32.16″,”DnsServer”); // Set DNS server IP Address

lr_save_string(“DNSSERVERNAME.CO.UK”, “Hostname”); // Set hostname to resolve


// Perform DNS Query

// Usage Notes:

// – IP Address of a Domain Name Server

//  – Name of host to resolve IP address for


results = (char *) ms_dns_query(“DnsQuery”,

“URL=dns://“,

“QueryHost=“,

LAST);


// List all the results… (if more than one)

while (*results) {

rescnt++;

lr_log_message(

lr_eval_string(“(%d) IP address for is %s”),

rescnt,

results);

results = (char *) ms_dns_nextresult(results);

}

return 0;

}

 

Author: Richard Bishop

http://about.me/richard_bishop