0

i am trying to do correlation to capture dynamic array value from server response. The problem is that the server is returning the list that i want to capture in javascript function and I am not able to capture it.

this is snippet

web_submit_data("planner.do", "Action=https://www.irctc.co.in/cgi-bin/bv60.dll/irctc/booking/planner.do?BV_SessionID={Session_Param}&BV_EngineID={Engine_Param}", "Method=POST", "RecContentType=text/html", "Referer=https://www.irctc.co.in/cgi-bin/bv60.dll/irctc/booking/planner.do?screen=fromlogin&BV_SessionID={Session_Param}&BV_EngineID={Engine_Param}", "Snapshot=t87.inf", "Mode=HTTP", ITEMDATA, "Name=BV_SessionID", "Value={Session_Param}", ENDITEM, "Name=BV_EngineID", "Value={Engine_Param}", ENDITEM, "Name=submitClicks", "Value=1", ENDITEM, "Name=screen", "Value=trainsFromTo", ENDITEM, "Name=browser", "Value=::: Explorer ::: Browser version is ::: 6 and Operating System is : Windows :: End of Navigator Info", ENDITEM, "Name=pressedGo", "Value=", ENDITEM, "Name=changetext", "Value=0", ENDITEM, "Name=bookTicket", "Value=", ENDITEM, "Name=stationFrom", "Value={stationFrom_Param}", ENDITEM, "Name=stationTo", "Value={stationTo_Param}", ENDITEM, "Name=CurrentMonth", "Value=3", ENDITEM, "Name=CurrentDate", "Value=2", ENDITEM, "Name=CurrentYear", "Value=2013", ENDITEM, "Name=day", "Value=26", ENDITEM, "Name=month", "Value=5", ENDITEM, "Name=year", "Value=2013", ENDITEM, "Name=JDatee1", "Value=26/05/2013", ENDITEM, "Name=userType", "Value=0", ENDITEM, "Name=ticketType", "Value=eticket", ENDITEM, "Name=quota", "Value=GN", ENDITEM, "Name=timedate", "Value=15", ENDITEM, "Name=backRoute", "Value=true", ENDITEM, "Name=Submit", "Value=Find Trains", ENDITEM, "Name=selectedIndex", "Value=1", ENDITEM, "Name=userName", "Value=", ENDITEM, "Name=password", "Value=", ENDITEM, LAST);

as a result a list os coming back like 4 train found or 7 train found,I want to correlate that value. If needed anything pls tell me.

Pulkit
  • 3,953
  • 6
  • 31
  • 55

2 Answers2

1

Unless your JavaScript function is executed on the server and the function is returned, then you cannot “capture it.” Capturing is reserved for information returned from the server exclusively.

If this is client JavaScript which is generating the dataflow back to the server then take the JavaScript function and rewrite it as a C function to calculate the value that you need to incorporate into your script. Or, move your client code development model up the OSI model stack to a VUSER type which will execute the JavaScript for you, such as TruClient, GUI, Citrix or RDP.

This answer leverages core pre-performance-testing-profession foundation skills in Client Architecture, Server Architecture and development skills in the language of your test tool.

James Pulley
  • 5,606
  • 1
  • 14
  • 14
  • thanx James. I got your idea of converting the script into c function...thanx a lot I got answer :D – Pulkit Apr 02 '13 at 14:21
1
Action()
{
  int i;
  int ncount;
  char ParamName[100];

  web_set_sockets_option("SSL_VERSION", "TLS");
  web_reg_save_param("trackingno","LB=;","RB= (NTN 0430)","search=All","ord=all",LAST);
  web_submit_data("barcode.pl", 
    "Action=http://qtetools.rmtc.fedex.com/barcode/cgi-bin/barcode.pl", 
    "Method=POST", 
    "TargetFrame=", 
    "RecContentType=text/html", 
    "Referer=http://qtetools.rmtc.fedex.com/barcode/html/barcode.shtml", 
    "Snapshot=t2.inf", 
    "Mode=HTML", 
    ITEMDATA, 
    "Name=formcode", "Value=0430", ENDITEM, 
    "Name=count", "Value=10", ENDITEM, 
    "Name=narrow", "Value=2", ENDITEM, 
    LAST);

  ncount= atoi(lr_eval_string("{trackingno_count}"));

  for (i =1;i <= ncount;i++)
  {
    sprintf(ParamName, "{trackingno_%d}", i);
    lr_output_message("Value of %s: %s",ParamName,lr_eval_string(ParamName));
  }

  return 0;
}
Meyer
  • 1,662
  • 7
  • 21
  • 20
teenaanie
  • 7
  • 2
  • Whilst this code may answer the question it would be much more useful if you explained what this code does and how it answers the question. Also, please [edit] the code to format it neatly. – AdrianHHH Jan 25 '17 at 12:17
  • This code should be obvious and apparent to anyone who has been through training on LoadRunner, either formal classroom training or the self paced tutorial which ships with the tool. The code assumes a foundation class of skills which are reasonable to assume for anyone using LoadRunner. There is a concern here as the code references a public website which the license for the tool expressly forbids unless the end user works for FEDEX and has permission to use the tools against the expressed interface. – James Pulley Jan 25 '17 at 13:58