Now that you have created the required automation infrastructure, you are ready to create your tests
Preparing for Test
Before you begin creating a test, ensure that your application and QuickTest are set to match the needs of your test. Important points are
- In Microsoft Internet Explorer, clear the AutoComplete option for user names and passwords (choose Tools > Internet Options > Content tab > AutoComplete Button).
- Close all browsers before you begin.
- Set the proper Web Page/Frame options. Open QuickTest, choose Tools > Options and click the Web > Page/Frame node. In the Create a new Page test object for area, select Different URLs or a change in data transfer and select the first four check boxes.
A step represents an operation to be performed on your application. For example, a step might click an image or insert a value into an edit box.
We will use the Mercury Tours Web site (http://newtours.demoaut.com/) and will make a reservation for a flight from New York to San Francisco on the Mercury Tours Web site, adding steps in various ways. After you add steps to the first action, you will analyze the steps to gain a better understanding of the Keyword View.
- Start QuickTest and open the MercuryTours test.
- If QuickTest is not currently open, open it as described in step 1 in Creating an Action, making sure that only the Web Add-in is loaded.
- Browse to and open the MercuryTours test.
- Open the Login action in the Keyword View.
- 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.
- Make sure that the Keyword View is displayed. Click the Keyword View tab if the Expert View is displayed.
- In the Test Flow pane, double-click the Login action. The Login action opens.
- Add the first step needed to log in to the Mercury Tours Web site.
- In the Keyword View, choose Insert > New Step. The Item list opens, displaying the top-level (parent) test object in the associated Login shared object repository (the Welcome: Mercury Tours browser object). You need to insert steps only on the objects on which you want to perform operations, so you do not need to insert a step on this object.
- Select Object from repository to open the Select Test Object dialog box and expand the test object tree.
- Select userName and click OK. The Select Object for Step dialog box closes and one step is added to the action, even though three rows are added to the Keyword View. (QuickTest adds a row for each of the parent test objects, but does not perform an operation on these objects. Therefore, these rows are part of the path to the object upon which the step is performed.) During a run session, QuickTest uses the parent objects to help identify the actual object on which it needs to perform an operation. In this step, the selected userName WebEdit test object is added to the Item cell; the default method, Set, is added to the Operation cell; but no documentation is added to the Documentation cell because the step is still missing a required value in the Value cell.
- In the Value cell, enter tutorial. Inserting this value completes the step. Documentation for the step in plain English is displayed in the Documentation cell when you click another area in the Keyword view.
- Click the Expert View tab to view the syntax of the step in VBScript. Browser(“Welcome: Mercury Tours”).Page(“Welcome: Mercury Tours”).WebEdit(“userName”).Set “tutorial”
Notice that this step is being performed on the WebEdit (edit box) test object and that – The test object hierarchy for the WebEdit (edit box) test object is displayed prior to the test object. The method to be performed on the object is displayed immediately after the test object. Full stops (periods) separate each part of the step.
- Click the Keyword View tab to return to the Keyword View.
- Add the next step.
- Choose Insert > New Step again to insert the next step.
- The Item list opens listing the sibling objects of the previous step’s test object.
- Select password from the Item list. The password WebEdit test object is added to the Item cell, and the default method, Set, is added to the Operation cell. You need to change this method because the password needs to be encoded. Also no documentation is added to the Documentation cell because the step is still missing a required value.
- Click in the Operation cell to display the down arrow, and then click the down arrow to display the list of available methods for the selected test object. Select SetSecure from the list. This method enables the use of encrypted text. Now you need to generate the encrypted text and insert it in the Value cell.
- Generate an encoded password.
- On your computer, select Start > Programs > HP QuickTest Professional > Tools > Password Encoder. The Password Encoder dialog box opens.
- In the Password box, enter tutorial.
- Click Generate. The Password Encoder encrypts the password and displays it in the Encoded String box.
- Click Copy. Paste the encoded value in the Value cell for the password step.
- Inserting a value completes this step. Documentation for this step is displayed in the Documentation cell.
- Click Close to close the Password Encoder.
- Insert the last step in the Login action.
- Click in the Item column below the last step to insert the next step. The Item list opens listing the sibling objects of the previous step’s test object.
- Select Sign-In from the Item list. This step instructs QuickTest to click the Sign-In button.
- Save your test. Choose File > Save or click the Save button.
Test Your Automation Testing Skills By Taking Our Free Practice Tests On This Link