Tag Archive: loadrunner



char *date=”27 mar 2010″;
char *position;
int offset;
char *search_str[20] = {“jan”,”feb”,”mar”,”apr”,”may”,”jun”};
char *search_strvalue[20] = {“01″,”02″,”03″,”04″,”05″,”06″};
char * tokens;
char reqValue[100];
int i,j;

vuser_init()
{
lr_save_string(lr_eval_string(date),”date_new”);
lr_output_message(“%s”,lr_eval_string(“New date is {date_new}”));

j=0;
do
{
position = (char *)strstr(date, search_str[j]);
offset = (int)(position – date + 1);
j++;
} while (offset != 4);

tokens=(char *)strtok(lr_eval_string(“{date_new}”),” “);
i=0;
while (tokens!=NULL)
{
if(strcmp(tokens,search_str[j-1])==0)
{
strcat(reqValue, ” “);
strcat(reqValue, search_strvalue[j-1]);
strcat(reqValue, ” “);
}
else
{
strcat(reqValue,tokens);
}
tokens = (char *)strtok(NULL,” “);
}
lr_save_string(lr_eval_string(reqValue), “NewFormatDate”);

return 0;
}

Advertisements

C:\Program Files\HP\LoadRunner\bin>mmdrv.exe -usr DateFormatChange\DateFormatChange.usr

scripts should be placed inside the bin folder..


Put this code inside the action:-

char filename[1024], command[1024];
char new_dir[] = “C:\\Sample”;

/* Create a directory under root called xyz and make it the current dir */
if (mkdir(new_dir))
lr_output_message(“Create directory %s failed”, new_dir);
else
lr_output_message(“Created new directory %s”, new_dir);

sprintf (filename, “%s\\%s”, new_dir, “SIVA.txt”);

/* Execute a dir /b command and direct it to a new file */
sprintf (command, “dir /b c:\\ > %s /w”, filename );
system(command);
lr_output_message(“Created new file %s”, filename);

return 0;


Below is the snippet to be used for performance testing the SMTP server with bulk email messages or per your project needs,

 

Action()
{
// connect to smtp mail server
smtp_logon(“Logon”,
“URL=smtp://{P_userID}@mail.o365am.xxx.com:xxxx”,
“CommonName=SMTP {P_userID}”,
“LogonUser={P_LoginEmailID}”,
lr_decrypt(“5d564d6e185f6c5457b32fc024bc4a91aaacc3c”),
“STARTTLS=STARTTLS”,
LAST );

// send email
smtp_send_mail(“SendMail”,
“To={P_RecepientEmail}”,
“Cc={P_RecepientEmail}”,
“Bcc={P_RecepientEmail}”,
“From={P_LoginEmailID}”,
“Subject=Testing SMTP message from Load Runner”,
“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 time
lr_think_time(2);

// disconnect from server
smtp_logout();

return 0;
}


Issue: “communication between vugen and the truclient browser could not be established”. This error occurs when we click the ‘Develop Script’ button.

Solution: Simple step, Run the Vugen.exe as ‘Administrator’.


Inorder to start scripting the SAP applications using the Loadrunner tool, we have to enable the scripting mode available in the SAP application apart from the normal script enabling setting.

Please use the TCode – RZ11

Navigate to the page it allows and change the settings to ‘FALSE’ for the below mentioned parameters.

a. sapgui/user_scripting_set_readonly and set the value as “FALSE”
b. sapgui/user_scripting_force_notification and set the value as “FALSE”

TY


In Loadrunner script, we use block size per vuser for using the huge range of unique values in a parameter. But during the test, if the execution failes inbetween its very hard to re-allocate the block size again by checking the unused values. In-order to solve this issue, we can use the LR_ADVANCE_PARAM function in loadrunner. Please find below the usage format to implement this.

 
Action()
{
int x,y,v,i;  // declare these variables as integer
v=atoi(lr_eval_string(“{VuserID}”));  // get the VuserID and store it in v
i=atoi(lr_eval_string(“{ItNum}”));  // get the Iteration number and store it in i
if(i==1)
 x=v;  // For the first iteration, x = VuserID
else
 x=6;  // For the second iterations onward, x = No of Vusers  + 1 (assuming Vusers = 5)
for(y=1;y<x;y++)
lr_advance_param(“CreatedCustID”);  // parameter file name (keep settings as Sequential Once)

————-

———-

———
return 0;
}


Note: checkboxvalueRaw is the list of correlated values which is being listed in the check boxes. It has to be checked in random numberr and submitted.

int i, j;

char checkboxvalue_param[100],temp_param[60], temp1_param[60];

web_reg_save_param(“checkboxvalueRaw”,”LB=XXXXX”,”RB=YYYYY”,”ORD=ALL”,”Notfound=warning”,LAST);

i=1;

j=(rand()%(atoi(lr_eval_string(“{checkboxvalueRaw_count}”)))+1);

lr_output_message (“i is %d, j is %d”, i,j);

do

{        sprintf (checkboxvalueRaw_param, “{checkboxvalueRaw_%d}”, i);

lr_save_string(lr_eval_string(checkboxvalueRaw_param), “checkboxvalue_sel”);

strcpy(temp_param, temp1_param);

strcat(temp_param, lr_eval_string(“{checkboxvalue_sel}”));

if (i<j)

{

strcat(temp_param, “,”);

}

strcpy(temp1_param, temp_param);

i=i+1;

}

while (i==j);

lr_save_string(lr_eval_string(temp_param), “checkboxvalue_sel”);


char newvalue[15]=”I Love India”;

long pfile;

char *filename = “C:\\Sample.txt”;

pfile = fopen( filename,”a+” );

if(pfile == NULL)

{

printf( “Error in opening the filename – %s “,filename );

}

fputs(newvalue,pfile );

fputs( “\n”,pfile );

fclose( pfile );


Hp-Sitescope

(1) Agentless monitoring tool

(2) No memory consuming tool.

Hp-Diagnostics

(1) Agent required tool

(2) Memory will be consuming in the monitoing servers. Even this may tend to affect the performance of the web application.