Forum Discussion
15 Replies
Sort By
Hi Johny,
The 500 status code usually means that an exception occurred in the tested web application. In other words, it means that something has gone really wrong when a request was processed. The "Load Testing Troubleshooter" (http://www.automatedqa.com/support/viewarticle/17305/) help topic contains information on how error details can be retrieved from server responses.- johny2010_1ContributorHi Allen,
Thank you for your advice. Finally I got the point that, the only way to get detailed information for a request was using writing script, bcos TestComplete does not receive this information by default. In order to get information for response body, I need to use events and stores etc.
So when I get response body, I am not sure if I will be satisfied for the real cause of 500 error. In my logic, I think that, if there is a trouble for a request with 500 status code error, that means also the body is corrupt, right ? I will be missing come code or corrupted. I am not sure yet how to defect problematic section from this response body yet, but I will try!
Hi Johny,
if there is a trouble for a request with 500 status code error, that means also the body is corrupt, right ?
Not necessarily. Most probably, the response will contain information on the specific error which occurred at the web server. For example, if an exception occurred, the response may contain the error message, the call stack and the name of the file in which the exception occurred.- johny2010_1ContributorHi Allen,
To get response body of a test, I need some help.
by using the method described in the help, I can get the response body of any request in the task
For getting response of the test results, the help gives a script example code as below
I need the definitions of Sender, User here. Where they come from and How will I sue them ?
I created some event helper, and next what I have to do in order to run this script ? Any idea?
function GeneralEvents_OnLoadTestingResponse(Sender, User, Request)
{
var FileName, BaseLineName;
// Checks whether the event is generated for the desired request
if(Request.RequestID == 2)
{
// Make up the name of the file that will hold the response contents
FileName = "C:\\Response_User" + User.Name +
"_Request" + aqConvert.VarToStr(Request.RequestID)+ "_" + _
aqConvert.DateTimeToFormatStr(aqDateTime.Now(),"%Y%m%d%H%M%S") + ".dat"
// Saving the response contents to a file
Request.ResponseBody.SaveToFile(FileName);
// Comparing files
BaseLineName = Files.NameByFileName("C:\\ResponseToCheck.dat");
if(! Files.Compare(BaseLineName, FileName))
{
// Report about an error
Log.File(FileName, "The response to the request " + _
aqConvert.VarToStr(Request.RequestID) + " for the user '" + User.Name +_
"' is invalid.", "File name: " + FileName, 500);
}
else
// Delete the file if the response is correct
aqFile.Delete(FileName);
}
}
----------
Best Regards,
Hi Johny,
An event handler is a routine which is called when a specific event occurs. Parameters passed to the function must not be populated manually - they'll be provided by TestComplete. I recommend that you see the "Creating Event Handlers for TestComplete Events" (http://www.automatedqa.com/support/viewarticle/11466/) help topic for information on event handling in TestComplete. You can find detailed steps in the help topics referenced in that topic.- exp1Occasional ContributorHi Allen,
Thank you for your reply, but there is a point I could not solve what is Request ID
In the helps it says,
The Request parameter is anHTTPRequest
object that provides a scripting interface for the request being sent. Use theHTTPRequest.RequestID
property to determine the request for which the event was generated.
and in the Request ID page, it saysThe 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.
Is Global Index is teh Request ID ?
I tried both way and started my test, but both cases returned error from the script code given above.
Can you tell me how I have to change the script to in order to get response body of a given request of a vuser in my test ?
Hi Celalettin,
Here's what you need to do:
1. Double-click the needed task node in the Project Explorer panel.
2. Select the problematic request you're interested in.
3. Enable the "Raise Events" option on the Request and Response tabs. This will make TestComplete generate the corresponding events when the request is sent and when a response is received.
4. The request ID is shown in the task editor ("Request XXXX", where XXXX is the request ID).
5. If you face some problems with the script execution, set a breakpoint in the event handler, start debugging and examine the actual values of the needed variables in the Watch panel or the Evaluate dialog.- exp1Occasional ContributorHi Allen,
I could not figure out the problem.
When I execute test with 60 Vuser.Result seems good.But when I increase Vusers to 70-80 I get in some Vusers HTTP 500 internal server error.
I couldn't figure with onloadeventhandler.(I'm not able with write script.)Also Help says "However, it is not recommended to use event handlers for tasks involving multiple virtual users. " in this topic "http://www.automatedqa.com/support/viewarticle/17305/"..
How can I figure it.
I have another question.I can see request execution summary for connection.But I want to see request execution summary for page.Because requirment says"Execution time for page(Without Image)<=0.5 s",and how can I calculate request count in second.I calcute this way:
Sum[requestCount]/Sum[Request Execution Summary(s)] but I'm not sure this is true value?
In the Run Time graph I see the Passed Request but it will changes during request count in the task.
Best Regards.
Hi Celalettin,
When I execute test with 60 Vuser.Result seems good.But when I increase Vusers to 70-80 I get in some Vusers HTTP 500 internal server error.
The body of requests 500 (Internal Server Error) responses usually contains some information on the error which occured on the server's side. I recommend that you show this error to the application's developers. The body can be retrieved via the HTTPRequest.ResponseBody property in the OnLoadTestingResponse event handler.
I couldn't figure with onloadeventhandler.(I'm not able with write script.)
Could you please describe the problem you face in detail?
Help says "However, it is not recommended to use event handlers for tasks involving multiple virtual users. "
Event handlers should be used for test debug purposes only, because they decrease the resulting web server's load significantly.
I have another question.I can see request execution summary for connection.But I want to see request execution summary for page.
Currently, test results can only be grouped by connections. You will need to evaluate the needed requests' time manually.
Sum[requestCount]/Sum[Request Execution Summary(s)] but I'm not sure this is true value?
It should be Sum[Request Execution Summary(s)]/Sum[requestCount], actually. However, since you need to deal with specific requests only, you will need to use Sum[(Request Time + Response Time)]/Sum[requestCount], where Request Time + Response Time is the sum of the corresponding values for each request.- exp1Occasional ContributorHi Allen,
>>>I couldn't figure with onloadeventhandler.(I'm not able with write script.)
<<<Could you please describe the problem you face in detail?
Sorry,
"onloadeventhandler" must be OnLoadTestingResponse event handler.I get
function GeneralEvents_OnLoadTestingResponse(Sender, User, Request)
{
}
but I don't know how I used this function for HTTPRequest.ResponseBody property.
I wrote another function for ResponseBody
function ResponseBody()
{
var request;
request=LoadTesting["HTTPTask"]("FAZ01_Butik")["Connection"](0)["Request"](1);
request["ResponseBody"]["SaveToFile"]("C:\\ResponseBody.dat");
Files["Add"]("C:\\ResponseBody.dat");
}
But I can not understand anything with this file.It writes hexadecimal.
If OnLoadTestingResponse event handler get me responseBody which Vusers-connection-request that warning.
Can you write for sample code for ["Connection"](0)["Request"](1);
And how can I use this code when test is execution or after execution.Of course if you write.:]
I have a few questions about Unit Testing but it is not the time..When it comes time to ask.
Thanks it will be very helpfull.