Saturday 17 August 2013

Guidelines for Working with Actions in QTP (QuickTest Professional)

Few guidelines to follow when working with actions in QTP:
1. If your action runs more than one iteration, the action must end at the same point in your application as it started, so that it can run another iteration without interruption. For example, suppose you are testing a sample flight reservation site. If the action starts with a blank flight reservation form, it should conclude with a blank flight reservation form.
2. A single test may include both global Data Table parameters and action (local) Data Table parameters. For example, you can create a test in which a travel agent logs into the flight reservation system, books three flights, and logs out; the next travel agent logs into the flight reservation system, books three flights, logs out, and so forth.
To parameterize the `book a flight’ action, you choose Current action sheet (local) in the parameterization dialog box and enter the three flights into the relevant Action tab in the Data Table. To parameterize the entire test, you choose Global in the parameterization dialog box and enter the login names and passwords for the different agents into the Global tab in the Data Table.
Your entire test will run one time for each row in the Global data sheet. Within each test, each parameterized action will be repeated depending on the number of rows in its data sheet and according to the run settings selected in the Run tab of the Action Properties dialog box.
3. You may want to rename the actions in your test with descriptive names to help you identify them. It is also a good idea to add detailed action descriptions. This facilitates inserting actions from one test to another. You can rename an action by choosing Edit > Action > Rename Action. (Make sure you follow the naming conventions for actions.)
4. If you plan to use an identical or virtually identical procedure in more than one test, you should consider inserting a call to an action from another test.
- If you want to make slight modifications to the action in only one test, you should use the Insert Call to Copy of Action option to create a copy of the action.
- If you want modifications to affect all tests containing the action, you should use the Insert Call to Existing Action option to insert a link to the action from the original test.
- If you want modifications to the action to affect all tests containing the action, but you want to edit data in a specific test’s Data Table, use the Insert Call to Existing Action option and, in the External tab of the Action Properties dialog box, select Use a local, editable copy.
5. When you insert a call to an external action, the action is inserted in read-only format, so the Record button is disabled. If you want to continue recording, you first need to insert a call to a local action into your test, or select a step from a local action that already exists in your test.
6. Reusable actions help you to maintain your tests, but it is important to consider the effects of making an action reusable. Once you make an action reusable, be sure to consider how changes to that action could potentially affect other tests that call that action.
7. If you expect other users to open your tests and all actions in your tests are stored in the same drive, you should use relative paths for your reusable actions so that other users will be able to open your tests even if they have mapped their network drives differently.
8. If you expect certain elements of your application to change regularly, it is a good idea to divide the steps related to changeable elements into a separate action so that it will be easy to change the required steps, if necessary, after the application is modified.
9. If you decide to remove an action, consider how that might affect your test or another test that contains a call to that action. For example, will it prevent a later action in the same test from running correctly? Will it cause the test containing a call to that action to fail?
(Source: HP QTP MAIN USER GUIDE)

No comments:

Post a Comment