top of page

Creating Custom Request in VuGen LoadRunner

Creating Custom Request in VuGen LoadRunner

THERE ARE SOME SITUATIONS WHERE YOU NEED TO CREATE CUSTOM REQUEST SO THAT YOU CAN MANIPULATE THE REQUEST ACCORDING TO YOUR NEED. HERE WE WILL SEE HOW TO CREATE CUSTOM REQUEST AND TAMPER WITH IT TO GET OUR JOB DONE. BASIC: WHEN WE RECORD THE SCRIPT FOR ANY WEB APPLICATION, WE GENERALLY CHOOSE HTML-BASED RECORDING BECAUSE IT IS EASY AND MINIMIZES THE CORRELATIONS YOU HAVE TO HANDLE IN THE SCRIPT.LOADRUNNER DO GENERATE CUSTOM REQUEST WHEN SOME REQUEST DOES NOT FALL UNDER CATEGORY OF LR_WEB_SUBMIT_DATA() OR LR_WEB_SUBMIT_FORM() REQUESTS CATEGORY.CHALLENGE:SUPPOSE THERE IS ONE REQUEST WHERE YOU ARE SENDING SOME DATA ITEMS WITH IT AND EVERY TIME THERE WILL BE RANDOM NUMBER OF DATA ITEMS LIKE, FIRST TIME THERE WILL BE FOUR DATA ITEMS SECOND TIME THERE WILL BE FIVE DATA ITEMS IN THE SAME REQUEST. HERE YOU CANNOT USE SAME RECORDED REQUEST AS NUMBER OF DATA ITEMS ARE GOING TO BE DIFFERENT EVERY TIME.IN BELOW EXAMPLE YOU CAN SEE THAT THERE ARE ONLY FOUR DATA ITEMS IN THE REQUEST NEXT TIME THERE MAY BE FIVE DATA ITEM.

"NAME=SEARCHRESULTSGRID_CTL04_VIEWPACKAGEDIALOGRESULT", "VALUE=291570", ENDITEM,"NAME=SEARCHRESULTSGRID_CTL08_VIEWPACKAGEDIALOGRESULT", "VALUE=291566", ENDITEM,"NAME=SEARCHRESULTSGRID_CTL11_VIEWPACKAGEDIALOGRESULT", "VALUE=291563", ENDITEM,"NAME=SEARCHRESULTSGRID_CTL12_VIEWPACKAGEDIALOGRESULT", "VALUE=291562", ENDITEM, SOLUTION: HERE YOU CAN CREATE A CUSTOM REQUEST AND USE A PARAMETER WHICH WILL HOLD THE MANIPULATED STRING OF DATA ITEMS. IN THAT STRING YOU CAN SAVE DIFFERENT NUMBER OF DATA ITEMS AND YOU CAN CHANGE IT AS REQUIRED.PROCEDURE:FIRST RECORD THE SCRIPT WITH HTML-BASED RECORDING AND WITH PROPER TRANSACTION NAMES FOR EVERY ACTION.SAVE THAT SCRIPT AND THEN CLICK ON TOOLS> REGENERATE SCRIPT…

BELOW POPUP WILL COME, CLICK ON OPTIONS…

IT WILL SHOW YOU THE REGENERATE OPTIONS, CLICK ON GENERAL> RECODING

  1. There are two options available, HTML-based script and URL-based script. Choose URL-based script. For URL-based script there is a button for advanced settings named URL Advanced, click on it. From the new popup select Use web_custom_request only. Save the settings and regenerate the script. In the regenerated script you can see that new script is generated which contain only web_custom_request. Now find the particular request which you want to manipulate with the help of transaction names which you have given while recording the script. Below is the HTML-based recorded request, You can see that there are four data items of grid results,

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

web_submit_data("managepackages.aspx_4", "Action=http://{p_Url}/site/secure/reportcenter/managepackages.aspx", "Method=POST", "TargetFrame=", "RecContentType=text/html", "Referer=http://{p_Url}/site/secure/reportcenter/managepackages.aspx", "Snapshot=t50.inf", "Mode=HTML", ITEMDATA, "Name=SearchResultsGrid_ctl03_ViewPackageDialogResult", "Value={c_PackageID}", ENDITEM, "Name=SearchResultsGrid_ctl04_ViewPackageDialogResult", "Value=291570", ENDITEM, "Name=SearchResultsGrid_ctl08_ViewPackageDialogResult", "Value=291566", ENDITEM, "Name=SearchResultsGrid_ctl11_ViewPackageDialogResult", "Value=291563", ENDITEM, "Name=SearchResultsGrid_ctl12_ViewPackageDialogResult", "Value=291562", ENDITEM, LAST);

Below is the custom request which is URL-based,

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

web_custom_request("managepackages.aspx_4", "URL=http:// {p_Url}/site/secure/reportcenter/managepackages.aspx", "Method=POST", "Resource=0", "RecContentType=text/html", "Referer= http://{p_Url}/site/secure/reportcenter/managepackages.aspx", "Snapshot=t135.inf", "Mode=HTTP", "Body=SearchResultsGrid_ctl03_ViewPackageDialogResult={c_PackageID}" "{final_string}", /*//below string is going to vary every time so we are going to manipulate it every time using string manipulation functions// "&SearchResultsGrid_ctl04_ViewPackageDialogResult=291570" "&SearchResultsGrid_ctl08_ViewPackageDialogResult=291566" "&SearchResultsGrid_ctl11_ViewPackageDialogResult=291563" "&SearchResultsGrid_ctl12_ViewPackageDialogResult=291562" */ LAST);

In custom request you can manipulate final string every time using string manipulation functions available in VuGen. final_sting= “&SearchResultsGrid_ctl04_ViewPackageDialogResult=291570&SearchResultsGrid_ctl08_ViewPackageDialogResult=291566&SearchResultsGrid_ctl11_ViewPackageDialogResult=291563&SearchResultsGrid_ctl12_ViewPackageDialogResult=291562″


bottom of page