Friday 17 June 2016

How to put strtok function in a vugen script


put the logic after the co-related string

strtok is used when you get a long value from load runner seperated by delimiters for example,( and you want to seperate each value from the delimiters

logic()
{

extern char *strtok(char * string,const char * delimiters); // explicit declaration

char seperators[]= "(,";

char *token;

char c[100];
char * a[100];
char * d[100];
int i=0;

strcpy(c,lr_eval_string("{c_ContentGUID}"));

token= (char *) strtok(c,seperators); //Get the first token

if(!token)
{

lr_output_message("No token found in the string");

return (-1);

}

for(i=0; token !=NULL;i++)
{
 a[i]=token;

lr_output_message("%s", a[i]);

token= (char *) strtok(c,seperators); // get the next token

}

lr_save_string( a[6],"c_ContentGUID");

lr_save_string( a[5],"c_fgfgh");

lr_save_string( a[2],"c_xyz");
lr_save_string( a[1],"c_sret");

lr_output_message("c_ContentGUID : %s", lr_eval_string("{c_ContentGUID}"));


return 0;

}


Tuesday 14 June 2016

WEB services Soap UI

Web services is a way of communication between two softwares .

For example Software one calling to a function of another software

medium will be Internel/LAN and http protocol, and i/p and o/p will be saved in SOAP(Simple object Access protocol)

Client is service consumer and server is service provider, to access the server you should know the location of the webservices server and information about the server functions.


If service provider knows the client,it will directly give the xml(WSDL file)

second way is through UDDI,first all the service provide register on UDDI

Server->xml(WSDL)->UDDI->xml(UDDI)->Client

WEB services are two types

1.SOAP based
2. REST based

In REST client send a request to server using URI and server return the response in terms of resources for example-HTML,plain test etc


How to save vugen co-related value in a file


In case you face such scenario in which you need to save your co-related value in a file.

For example

web_reg_save_param("c_Incident","LB=abc", "RB=def", LAST);

// call this function wherever you want to save your co-related value
writeInfoToFile();

void writeInfoToFile();
{
           long File_Stream;
Char *Filename="D:\\Incident.txt";
//Open the file with read access

If((File_Stream= Fopen(Filename,"a+"))==NULL)
{
lr_error_message("Can't open %s ", Filename);
}

fprintf(File_Stream,"\r\n%s", lr_eval_string("{c_Incident}"));


//Close the file
If(fclose (File_stream))
{
 lr_error_message(error close file %s ",Filename);
}
}