Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawbacks of using too many function calls?
#1
Solved: 10 Years, 7 Months, 3 Weeks ago
We are creating QTP scripts to validate the UI screen elements (presence, weblist contents, checkboxes, etc). I had created a function called "validateObjects" and saved it in the library file (.vbs). I was calling this function in my script by passing the object properties as parameters (we following DP).
The function will verify the presence of the objects on the screen and report pass or fail accordingly.

As expected, the number of function calls were too many in the script. For each UI element i had inserted the function call.

Our client manager is not happy with the script. He is saying it will bring down the QTP performance. When asked how, he informed us to find out by ourselves. I googled for the information. But no luck so far.

for the busy-experts, here is one liner question - "Will the QTP script take more time to execute when a lot of function calls are present in the script? If Yes, how?"
Reply
#2
Solved: 10 Years, 7 Months, 3 Weeks ago
I would say performance is affected. When you call a function there is a hit on the memory QTP utilizes. You call multiple functions and then heap of memory is under consideration. This affects performance in turn slows down the execution if memory management is not performed well.

I wouldnt say if you write a 1000 functions, the performance is hit. It would matter if you had not released the objects you create accordingly. Moreover, optimization is what is required for you.
Say, you have 100 objects on the screen. When you begin, if you write one function which creates all of the objects and you have operation to be performed only on say 10 objects. In this case, all of the 100 objects are first initalized and then operation on 10 objects is performed. Isint it useless to create 90 more objects? So, break it down. Create multiple functions for each of the screen attributes you have. For eg: IF you are automating Gmail, you create objects for Inbox in a function and then sent mail in a different function or probably New email objects in one function and so on and so forth. This way you can optimize and cause a less hit on the memory and improve the performance.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a Function in Function Library when function is defined in an Action jitenderkkr 0 2,750 11-27-2014, 12:53 PM
Last Post: jitenderkkr
  RegisterUserFunc fails when one calls another Archens 2 2,641 08-23-2012, 10:34 PM
Last Post: Archens
  Testing web Application that makes AJAX calls pendri 2 3,782 05-24-2011, 02:36 PM
Last Post: surya_7mar
  How can I fetch server time using function Now or any other function? blanchedsouza 2 4,820 11-07-2009, 08:34 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 1 Guest(s)