I had a dbt..Which is the best practice..to create a function or a reusable action?..anyhow in function u cannot include checkpoint and u have to do descriptive programming..Wht is the advantage of using Function over reusabel action..If possible explain with a scenario..
Thanks in advance..Thilak
Well it depends on the scenario that you have in front. Function are basically made when you think there will reusability across other scripts. Example would be function related to string where you want string between two specified characters. Then you can make functions in your script to make the script more readable. Example
But the only thing is that function have to be used with action. Otherwise you will loose the advantage of the OR that QTP provides. Again no body can say which one is better but given a scenario you can choose which one is a better option.
As I see the OR and checkpoints to be liabilities instead of advantages, we use external reusable functions as much as possible.
We use reusable actions to contain code for AUT function-specific test scripts organized as follows:
1.) declarations of local constants specific to the test script
2.) declarations of local variables specific to test script
3.) code for test script entry handler. In most cases, handlers call functions in external libraries.
4.) any local functions used by test cases in the test script
5.) code for test cases in test script. In most cases, test cases are calling functions in external libraries.
6.) code for test script exit handler
Our QTP projects reference external libraries organized into generic and AUT-specific function library files. Global constants and variables are defined in AUT-specific library files.
We use library functions and formatted worksheets in the data table in place of checkpoints. We have implemented something similar to the XML-based DP object repository, except our object references are stored in a specially formatted worksheet in the data table.
Hi Mark, If we place recorded script inside a function..It is scenario or application specific..As Functions are reusable components it should be generic..so tht we can call tht function to any scenarios..Sorry if i am wrong..
Anyhow thx all for the replies