Thursday, December 18, 2008

LoadRunner Page Size Capture

LoadRunner Page Size Capture


The biggest hole in Mercury LoadRunner is its lack of page size monitoring. LoadRunner can monitor anything else imaginable, including transaction counts, transaction times, errors, and all Windows Performance Monitor metrics. However, monitoring page size, download times, and HTTP Return codes are only available through programming.


//Define the data types in int Section of the script
int iPageSize;
char *grouname;
char filename[1024];
long file;
int nItr;

//Create a unique file name
strcpy(filename, "C:\\tmp.txt");

// OPen the file as write mode ie: "w"
if ((file=fopen(filename,"w"))==NULL

{
lr_output_message("unable to open the file",filename);
}


// write the iteration number in the action section top
fprintf(file, "\nCurrent iteration #: %d\n", nIt++);

Some transaction.
..
..
web_url.....
web_submit_data(...
// After every web_url(…) script when you want to capture the page size
// or At the end of transacation, add the following code snippet:

iPageSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE,);
fprintf(file, "Transaction name: %d Bytes\n", iPageSize);

//like that we can get the download time, return code


iRetcode=web_get_int_property(HTTP_INFO_RETURN_CODE);
downloadtime=web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);

fprintf(file, "Transaction name: %d\n", iRetcode);
fprintf(file, "Transaction name: %d MilliSeconds\n", downloadtime);

//finally close the file
//Close the file after you finished all the page size capture and writing:
fclose(file);

No comments:

Post a Comment