Forum Discussion
15 Replies
Hi Celalettin,
Your current code stores the recorded, not run-time, value of response body. I guess that's not what you need. The current request for which the OnLoadTestingRequest event is generated can be accessed via the Request variable passed to your event handler. Note that this event is generated only for those responses for which the "Raise Events" option is enabled on the Response tab of the Task Editor. If the option is enabled for multiple responses, you can use the unique ID of the request to identify the needed response. For example:
function GeneralEvents_OnLoadTestingResponse(Sender, User, Request)
{
if (Request.RequestID == myRequestId)
{
Log.Message("Response body for Request " + myRequestId, Request.ResponseBody.Contents);
}
}- exp1Occasional ContributorHi Allen,
Thank you for your solution. I actualy got the records response body in order to compare with run
time response body, but I couldnt get the run time equivalent of it.
When I add an OnLoadTestingResponse, it automatically adds this function to scripting.
The real problem is how will I specify these (Sender, User, Request) parameters ?
How can I get this function to work ? Do I have run my test through a script, in order to get paremters for this function?
If so what additional script code I have to add in order to get requestID or run-time spesific requests response body ?
By the way, in the help for request ID , it writes that;
"The request ID identifies the request within the entire HTTPTask. It is displayed in the tree of connections and request in the Load Testing Task editor. Do not confuse request id with the index of the request in the requests collection of a connection."
What you say about this ? I understand it is wrtitten in the task editor , but where ? Can you explain this statement? - exp1Occasional ContributorHi Allen,
I added extra two lines in order to get requestID, and run the test as usual,and noticed that the actually the function was triggered
after that I see just see this "{" character in the log result under Additional Information tab.
What does it mean ? I wrote my script code below, please have look at it.
function GeneralEvents_OnLoadTestingResponse(User,Sender,Request)
{
Request=LoadTesting["HTTPTask"]("FAZ02_Basket")["Connection"](1)["Request"](0);
var myRequest=Request["RequestID"];
if(Request.RequestID==myRequest)
{
Log.Message("Response body for Request"+myRequest,Request.ResponseBody.Contents);
}
} - exp1Occasional ContributorHi Allen,
I added extra two lines in order to get requestID, and run the test as usual,and noticed that the actually the function was triggered
after that I see just see this "{" character in the log result under Additional Information tab.
What does it mean ? I wrote my script code below,
function GeneralEvents_OnLoadTestingResponse(User,Sender,Request)
{
Request=LoadTesting["HTTPTask"]("FAZ02_Basket")["Connection"](1)["Request"](0);
var myRequest=Request["RequestID"];
if(Request.RequestID==myRequest)
{
Log.Message("Response body for Request"+myRequest,Request.ResponseBody.Contents);
}
}
Best Regards.
Hi Celalettin,
We have received the project suite you submitted. We analyze the project suite and let you know our results via e-mail.