Using Parameterized Actions
Hello, having been asked by my organization to teach myself QTP and subsequently being the only user of it, I think that my approach to QTP programming maybe a bit quirky! However, I was wondering if my method is completely off the wall or whether there is some method in my madness. We have recently taken on a vastly more experienced QTP user to assist me, and he was completely baffled by my style!!
Basically, I am heavily using re-useable parameterized actions. I have one script which is a repository for all my actions. This script is purely a repository and cannot be run. Within this there is an action (in some cases two where a screen is particularly complex)for each screen. All variables fed into and out of an action are parameterized via action call properties.
In my real scripts, these re-useable actions are called various times as required and the parameters which are passed to the action either set to a value on the Global spreadsheet if required else set to a constant. The returned parameters are either stored or ignored if not required.
When viewed in Expert View, the Action Calls can look a bit a confusing as they are basically one long string of variables and constants, but when viewed in Keyword View, they are mapped to the related parameter.
My colleague is suggesting that using the local spreadsheets for each action is a lot more user friendly and within the accpeted QTP approach, but I think that my parameterized actions allow new scripts to be built much quicker.
Any thoughts anyone?
Re: Using Parameterized Actions
If you have lots of actions that are reusable across your test scripts then as per my experience it will be better to put them in form of functions and create a .vbs file. You can use this .vbs file anywhere in any script. The functions can be more general like writing data to excel file, retreiving data from excel file. Moreover the functions created by you in this scenario can also be reused by other user who can start working on QTP in future in addition to your efforts.
I feel this way of managing the repetitive task much better to handle.