An action (function) is a collection of operations that when combined form a logical business flow (such as Login, Logout, Search etc).There are 3 types of QTP actions:
- Reusable – only these can be called multiple times within the same or different tests
- Non-reusable – These cannot be called by any other actions
- External actions – a reusable action when called from another action becomes an external action in the called action.
- You can create New Actions for a test
- Test Flow that gets generated while Action is created is just for reference and sometimes disguises as Actions in the test flow show linkage but until unless you mention (Runaction command) in the script you will not able to call actions.
- Right click on Action-> Go to Properties -> Select Checkbox(Reusable)
- Looks like Non Reusable Actions could not be called/ reused.
- By default all Actions are Reusable
- Looks like when action is pulled in to another test using call to existing action(Object Repository is disabled when called, and viewed in 'External action' folder) and call to copy of action (Object Repository is not disabled, viewed in same folder as that of current action), they will be created as sub actions in the main action.
- Syntax used to run the actions/subactions is: RunAction '<action name>', <No. of Iterations>
- Script.mts – This file stores the code inside the action file
- ObjectRepository.bdb – This file stores the Local Per-Action object repository for the action
- Resource.mtr – This file contains neccessary information about the action (Reusable or not, Input/Parameters, Name, Description, Associate object repositories). This file is store in QTP proprietary format not know to anyone
- Snapshot – This folder contains all the Active screen related information about the Test
To run an action dynamically the only thing required is to execute its code present in Script.mts file. So below statement would run the Action: Dynamic Action Call – Part 1
Actions have their own Datatables and OR, but functions don’t. More importantly, Functions are VBScripting element, not only applicable to QTP.
- Reusable Actions: Note:11/8/2015:Right click on Action -> Select Properties -> Select 'Reusable Action' checkbox.How to make action Reusable: Actions that can be used in QTP scritp file into another Actions performed in action:
Ex: Use RunAction method, to call actions from existing action. Create New action: Design - > Create New Action- Copy the existing action, that exist in the present qtp file or copy from other qtp files – Design -> Copy of action- RunAction – method is used to call other Actions from present action.
- We can useInsert->New ActionMake sure you select Reusable action checkbox is selected.(if it is a reusable action)Once Reusable action is created, using Insert option in menu select Call to existing action, browse the QTP script file that has reusable action, and then reusable actions from that file. So that those actions would be displayed in the script.Use Insert -> Copy of the actions. Select the the script file that has actions, then the script displayed in the new action is:RunAction 'Copy of Login", oneiteration '"Copy of Login" is one of hte copy that is copied and copy is created in the actions list. Action is nothing but a re-usable component. A saved QTP test script action consist of 4 components Running an Action dynamically ExecuteFile "<ActionFolderPath>\Script.mts" Source: http://www.knowledgeinbox.com/articles/qtp/advanced-qtp/dynamic-action-call-part-1/
Actions how are they different from Fucntions:
Do you have any conditions to use Reusable Actions. Like Reusable actions cannot be used in specific tests. Such as Access modifiers will have.
ReplyDelete