Forum Discussion
AlexKaras
14 years agoChampion Level 3
Hi Andrei,
Unfortunately, I am not a load testing guru with TestComplete (unfortunately...) but have only some limited experience and hope that guys from Support will correct me in case of error, but below is my understanding and comments:
> [...] I identify the request that contains the response, click de "Raise Event" checkbox,
On the Response tab in order for the event to be generated exactly for the response but not for the request.
> add the OnLoadTestingResponse for it, and use the following code to search for the string [...]
Yes, it should be enough if you set event to be generated for one response only. Otherwise, the code in the event handler should check properties of the Request parameter to process the response only for the needed request.
> var Request = LoadTesting.HTTPTask("LiveData_PingTest").Connection(0).Request(2).ResponseBody.Contents;
This line seems to be incorrect for two reasons:
a) it redefines (and thus overwrites) the Request parameter;
b) the LoadTesting.HTTPTask("LiveData_PingTest").xxx refers to the data (actually, creates a copy of the data) that were recorded and saved by TestComplete during load task recording. As you need to analyze the contents of actual response, the line should be like this:
var Response = Request.ResponseBody.Contents;
> this searches within every virtual users responseBody [..]
Correct. Unless you filter out some virtual users by processing the User parameter.
Unfortunately, I am not a load testing guru with TestComplete (unfortunately...) but have only some limited experience and hope that guys from Support will correct me in case of error, but below is my understanding and comments:
> [...] I identify the request that contains the response, click de "Raise Event" checkbox,
On the Response tab in order for the event to be generated exactly for the response but not for the request.
> add the OnLoadTestingResponse for it, and use the following code to search for the string [...]
Yes, it should be enough if you set event to be generated for one response only. Otherwise, the code in the event handler should check properties of the Request parameter to process the response only for the needed request.
> var Request = LoadTesting.HTTPTask("LiveData_PingTest").Connection(0).Request(2).ResponseBody.Contents;
This line seems to be incorrect for two reasons:
a) it redefines (and thus overwrites) the Request parameter;
b) the LoadTesting.HTTPTask("LiveData_PingTest").xxx refers to the data (actually, creates a copy of the data) that were recorded and saved by TestComplete during load task recording. As you need to analyze the contents of actual response, the line should be like this:
var Response = Request.ResponseBody.Contents;
> this searches within every virtual users responseBody [..]
Correct. Unless you filter out some virtual users by processing the User parameter.
Related Content
- 6 months agomacheshmeh
- 2 years agoianlop
- 11 months agoIso_Yura
- 4 years agomcbane
Recent Discussions
- 4 hours agoSubhraDas
- 10 hours agoJacobjacob44