Automation Testing Tutorial | Working with Action

There are three options to insert a QTP action. Click on each one of those to know more about the selected type of action.

Action Type Description
Insert Call to New Action Inserts a New Action from the existing action
Insert Call to Copy of Action Inserts a copy of an existing action
Insert Call to Existing Action Inserts a call to existing re-usable action

Creating an Action

Each QuickTest test comprises calls to actions. QTP Actions are units that divide your test into logical sections. When you create a new test, it contains a call to one action. By dividing your tests into calls to multiple actions, you can design more modular and efficient tests.

QuickTest lets you insert several types of actions into tests. An internal action is an action that is stored in the local test (also known as a source test). An external qtp action is a referenced call to an action that is stored in a different test. For example, you may have an action that you want to use in multiple tests—you would store the action as an internal action in one test and insert calls to that action from other tests. In the other tests the action would be available as an external action.

When you insert a call to a new action, it is reusable by default, enabling you to insert calls to the qtp action from any test. Reusable actions are especially useful when you have a process that you may need to include in several tests, such as logging in to your application, or that you may need to insert several times in the same test, such as filling in user credential dialog boxes that open whenever a user tries to access a secure part of your application. Reusable actions can be internal or external actions.

If you want to prevent a qtp action from being reused in any test, you can make it non-reusable. Non-reusable actions are internal actions that can be used only once.

In this section, you will create a new test and rename an action so that anyone viewing this test will know the purpose of the action.

Start QuickTest.

  • If QuickTest is not currently open, choose Start > Programs > HP QuickTest Professional > HP QuickTest Professional. In the Add-in Manager, confirm that the Web Add-in is selected, and clear all other add-ins. Click OK to close the Add-in Manager and open QuickTest. While QuickTest loads your selected add-ins, the QuickTest splash screen is displayed. This may take a few seconds.
  • If QuickTest is already open, check which add-ins are loaded by selecting Help > About QuickTest Professional. If the Web Add-in is not loaded, you must exit and restart QuickTest. When the Add-in Manager opens, select the Web Add-in, and clear all other add-ins. If the Add-in Manager does not open when starting QuickTest, choose Tools > Options. In the General tab, select Display Add-in Manager on startup. When you exit and restart QuickTest, the Add-in Manager opens.

Create a new test in one of the following ways:

  • In the Start Page window, in the Welcome! area, click the New Test
  • In the QuickTest main window, choose File > New > Test, or click the New button down arrow and choose Test. If a test is already open, clicking the New toolbar button opens a new test. A blank test opens.

Rename Action1 so that it has a logical name.

  • Click the Test Flow tab to display the Test Flow pane. If you do not see the Test Flow tab, choose View > Test Flow or click the Test Flow Pane button to display it.
  • In the Test Flow pane, select Action1 and choose Edit > Action > Rename Action. In the confirmation box, click Yes.

qtp action

  • In the New name box, enter Login.
  • Click OK to save the change.

Create a new qtp action named FlightFinder.

  • Choose Insert > Call to New Action or click the Insert Call to New Action button . The Insert Call to New Action dialog box opens.

qtp action

  • Enter FlightFinder in the Name box, confirm that both Reusable Action and At the end of the test are selected, and click OK. The dialog box closes and the FlightFinder action is added to the end of your test.

Create calls to additional actions.

Repeat step 4 to add the following actions:

  • SelectFlight
  • BookFlight

Your test now contains all of the actions needed to begin this tutorial.

Save your test

  • Choose File > Save or click the Save button . The Save dialog box opens to the Tests folder.
  • Create a folder named Tutorial, select it, and click Save.
  • Enter MercuryTours in the File name
  • Confirm that Save Active Screen files is selected.
  • Click Save. The test name (MercuryTours) and path are displayed in the title bar of the main QuickTest window.

If a test has changed and is not yet saved, the test name in the title bar contains an asterisk.

Test Your Automation Testing Skills By Taking Our Free Practice Tests On This Link

Share this post
[social_warfare]
Automation Testing Tutorial | Actions Basics
Automation Testing Tutorial | GUI Objects

Get industry recognized certification – Contact us

keyboard_arrow_up