RSS Feed

Actions in QTP (QuickTest Professional) and How to create them

Actions break up the test into logical sections/units such as specific activities that we perform in our application.

If you create a test in which you log into the system (email), check inbox, and then log out of the system (email), your test might be structured as shown—one test calling three separate actions:

Test 1 Actions stored with Test 1
Call to action 1 —> Action 1(Logging In)
Call to action 2 —> Action 2(Checking Inbox Mails)
Call to action 3 —> Action 3(Logging Out)

Actions make it possible to parameterize and iterate over specific elements of a test. They also make it easier to re-record steps in one action when part of your applicationchanges. For every action called in the test, QuickTest creates a corresponding actionsheet in the Data Table so that we can enter Data Table parameters that are specific to that action only.

Three types of actions are:

Non-reusable action :  This non reusable action can be called only once and that too in the test with which it is stored.

Reusable action: Reusable actions are like functions in any programming language. If there is a process that needs to be included in several tests, we can record, modify, and enhance the steps of the process and save them in a reusable action. Then we can call the action from other tests, rather than recording, modifying, and enhancing the same steps each time. It can be called several times by the testwith which it is stored (the local test), as well as by other tests.

Deleting a reusable action that is called by other tests will cause those tests to fail.

External action is a reusable action stored with another test. External actions are read-only in the calling test, but we can choose to use a local, editable copy of the Data Table information for the external action. When a call to an external action is inserted, the action is inserted in read-only format

We can create an additional call to any reusable or external action in the test by pressing CTRL while we drag and drop the action to another location at a parallel (sibling) level within the test.

By default, new actions are non-reusable. Each action created in a test can be marked as reusable or non-reusable.

When we run a test with multiple actions, the test results are divided by actions within each test iteration so that we can see the outcome of each action, and can view the detailed results for each action individually.

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.

You can create new actions and add calls to them, as needed.

You can call the new action from your test flow as a top-level action, or you can call the new action from within another action in your test as a sub-action (or nested action).

You can also split an existing action into two actions.

To create a new action in your test:

  1. If you want to insert a call to the new action from an existing action in your test, click the step after which you want to insert the new action. To insert a call to the new action from the test flow as a top-level action, click any step.
  2. Select Insert > Call to New Action or click the Insert Call to New Action button on the Insert toolbar. The Insert Call to New Action dialog box opens

Create Actions_thumb[3]

  1. In the Name box, type a new action name or accept the default name. If you rename the action, make sure that the action name is unique (within the test), does not exceed 1023 characters, does not begin or end with a space, and does not contain the following characters:  \ / : * ? ” < > | % ‘ ! { }
  2. In the Description box, add a description of the action. You can also add an action description at a later time using the Action Properties dialog box.Tip: Descriptions of actions are displayed in the Select Action dialog box. The description makes it easier for you to choose an existing action you want to call.
  3. Ensure Reusable Action is selected if you want to be able to call the action from other tests or multiple times from within this test. By default, this option is selected. You can also set or modify this setting at a later time using the Action Properties dialog box.
  4. Decide where to insert the call to the action by selecting At the end of the test or After the current step. Choosing At the end of the test creates a call from the test flow to a top-level action. Choosing After the current step inserts the call to the action from within the current action (nests the action).Note: If the currently selected step is a reusable action from another test, the new action is added automatically to the end of the test (the location options are disabled).
  5. Click OK. A new action is stored with your test and the call to it is displayed at the bottom of the test or after the current step. You can move your action call to another location at a parallel (sibling) level within your test by dragging it to the desired location. For more information on moving actions, see Using the Test Flow Pane.
  6. If you inserted the call to the new action while editing your test, make sure your new action is selected before adding steps to it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: