Forum Discussion
20 Replies
- AlexKarasChampion Level 3Hi,
HTTP load testing operates with the http(s) protocol only and does not involve user interface of the tested application. Thus it is of no use to use UI functions like WaitAliasChild() during load test. What load test does is it creates http(s) request, sends the request to the tested server, waits for the server's response and compares the obtained response with the expected one.
I would recommend you to look at the "Checking Server Response" help topic, hope it will help. - sgudaRegular ContributorSo by what you mean i cannot insert any script routines or any thing which will perfom some functions to estimate time to load report or anything like that.
Another thing is in Http performance testing under the same project can i record different steps of test as different tasks fro the same test.
Like my Load test Project --- L_Adv_CrystalReport
Test --- Adv_CrystalReport
Tasks --- Adv_Login
--- Filter_Fields_Campus
--- Export_Report
--- Close_Report
If i record like this by designing the test with the ramping load and when i run the test, will it execute all the tasks in sequence.
Also i want to run this with one use, Multiple users, Few users with one login id and password another set of users with another login id and password.
1. Please let me know what would be the best way to record this scenario.
2. Can i execute how i ma planning with VU'S.
Please let me know, that will be great ful. - tarleaaContributor
Hello Alex,
How can I search for a text within the LoadTesting.HTTPTask().Connection().Request().ResponseBody.Contents ?
Is there a way to do this without the OnLoadTestingResponse Event ?
Thank you,
Andrei
- tarleaaContributor
If OnLoadTestingResponse must be used, what are the solutions in searching a text within the ResponseBody of a request, except file comparison?
Thanks,
Andrei
- AlexKarasChampion Level 3Hi Andrei,
> If OnLoadTestingResponse must be used, what are the solutions in searching a text within the ResponseBody of a request, except file comparison?
Not sure if I understood correctly though anyway...
ResponseBody variable (available in the OnLoadTestingResponse(Sender, User, Request) handler via Request.ResponseBody.Contents) contains the response from the server. It will be text that you can work with directly if server responded with the textual data. If the server responded with binary data (e.g. with picture file), then this data must be decoded and, probably, saved to file for further processing. - tarleaaContributor
Hello Alex,
My question is how can I find a given string within the Request.ResponseBody.Contents ? I've manage to post the response body to the Log, but that's it.
I'm looking something like
Find("textContent", "*textToSearch*"); (which is available in UI based tests, of course)
Note that I can't use file comparison because the content of the responseBody is dinamic.
Thank you,
Andrei
- AlexKarasChampion Level 3Hi Andrei,
I would recommend you to look for the methods of the aqString Object in TestComplete help.
Alternatively, you may consider using regular expressions ('Using Regular Expressions in Scripts' help topic).
Does this help? - tarleaaContributor
Hi Alex,
It surely helped.
So, let's see if I get this right:
I have a responseBody that needs checking if it contains a certain string. So, I identify the request that contains the response, click de "Raise Event" checkbox, add the OnLoadTestingResponse for it, and use the following code to search for the string:
function PingEvent_OnLoadTestingResponse(Sender, User, Request)
{
var Request = LoadTesting.HTTPTask("LiveData_PingTest").Connection(0).Request(2).ResponseBody.Contents;
if (aqString.Find(Request, "Welcome") != -1)
{
Log.message("string found");
}
else {Log.Error("string not found");}
}So this searches within every virtual users responseBody for the given string, corect?
Thanks,
Andrei
- AlexKarasChampion Level 3Hi 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. - tarleaaContributor
Hello Alex,
I'm still having some issues with my load test. I have 2 different tasks for which I want to check the responseBody (script A and B). So, basically, here's the problem. I've created an event handler for script A and an event handler for script B. This is the event handler for script A.
function A_OnLoadTestingResponse(Sender, User, Request)
{
var ping = Request.ResponseBody.Contents;
if(aqString.Find(ping, "Welcome A") != -1)
{
Log.Message("String found.Test passed");
}
else
{Log.Error("String not found.Test failed");}}
But when I run the test A that is associated with task A, in the log it shows that it also checked for the string that coresponds to the script and event handler B. So basically, by running task A, I get load test results for task A and event handler results for task A and for task B. What am I doing wrong?
Related Content
- 6 months agomacheshmeh
- 2 years agoianlop
- 11 months agoIso_Yura
- 4 years agomcbane
Recent Discussions
- 5 hours agoSvetaG