0
votes

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.

2

2 Answers

1
votes

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.

1
votes
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;
}