Ask a Question

Property check points or insert script routine in Http load testing tasks.

sguda
Regular Contributor

Property check points or insert script routine in Http load testing tasks.

In HTTP testing,



Is it possible to insert property check points or script routines in the task.



Suppose i am doing different tsaks like login, findreports etc. i want to include the script routine in the task like to wait for alias child or script routine to estimation the execution time of the report etc. How can i do this . please let me know as soon as possible.



Thanks a lot.
20 REPLIES 20
AlexKaras
Community Hero

RE: Property check points or insert script routine in Http load testing tasks.

Hi,



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.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sguda
Regular Contributor

RE: Property check points or insert script routine in Http load testing tasks.

So 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.




tarleaa
Contributor

RE: Property check points or insert script routine in Http load testing tasks.

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




  

tarleaa
Contributor

RE: Property check points or insert script routine in Http load testing tasks.

If OnLoadTestingResponse must be used, what are the solutions in searching a text within the ResponseBody of a request, except file comparison? 


Thanks, 


Andrei

AlexKaras
Community Hero

RE: Property check points or insert script routine in Http load testing tasks.

Hi 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.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
tarleaa
Contributor

RE: Property check points or insert script routine in Http load testing tasks.

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

AlexKaras
Community Hero

RE: Property check points or insert script routine in Http load testing tasks.

Hi 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?
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
tarleaa
Contributor

RE: Property check points or insert script routine in Http load testing tasks.

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

AlexKaras
Community Hero

RE: Property check points or insert script routine in Http load testing tasks.

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.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: