Saturday 27 August 2016

IP spoofing in loadrunner vugen and performance center

IP of client machine's is identity used by Servers and Network devices like routers to recognize them and then to cache the information and optimize themselves.
Sometimes we need to use different IPs to emulate the real world scenarios to make servers and devices see as if users are coming from different sources.

But this task is not simple.

Our job here is to fool the devices and it requires three simple steps:

1. Run IP Wizard (Start > Program Files > LoadRunner > Tools > IP Wizard) on LG to add the IPs you want to emulate in scenario.

2. Update the server’s routing table with new IPs, this is done so that servers are able trace back to the client. If client and server are in same network and subnet mask then not need of modification is required.
To update the table edit the batch file in IP wizard summary use route command as below to update:
“route ADD [IPs you want to add] MASK 255.255.255.255 [Your_IP] METRIC1”
“route ADD [IPs you want to add] MASK 255.255.255.255 [Your_IP] METRIC2”
Now run this .bat file on server to update.

3. Enable IP Spoofing ( Scenario > Enable IP Spoofer ) from Controller, before connecting to LG.

Thursday 11 August 2016

Replace function used Vugen scripts

char *strSource;

void Replace( char *strSource, char *strFrom, char *strTo, char *strParam)
{

   char strTemp[1024];

char *s= (char *)strSource;
int i=0;
int iLenFrom = strlen (strFrom);

int iLenTo = strlen(strTo);

while(*s)
{

if(strncmp (s,strFrom, iLenFrom) ==0)
{

strncpy(&(strTemp[i]), strTo, iLenTo);
i+=iLenTo;
s+ =iLenFrom;
}

else
{
  strTemp[i++] =*s;
s++;
}


}


strTemp[i] =0;
lr_save_string(strTemp,strParam);

}


//how  to call replace function

strSource= lr_eval_string("{c_ESS}");

lr_save_string(strSource,"c_ESS_New");

Replace(strSource,"&#x21", "!","c_ESS_New");