Creating New Actions
In this exercise you will create a test and divide it into three action calls.Recording the Test
1 Start QuickTest and open a new test.
For more information, see step 1 of “Recording a Test” on page 10.
2 Start recording on the Mercury Tours Web site.
In the coming steps, you will record a test similar to the one recorded in the “Recording Tests” lesson. However, this test is designed slightly differently
to optimize the test for a multi-action test.
Confirm that all Web browsers are closed.
Choose Test > Record or click the Record button. The Record and Run Settings dialog box opens.
➤ In the Web tab, select Open the following browser when a record or run session begins.
Choose a browser from the Type list and confirm that the URL in the Address box is http://newtours.mercuryinteractive.com.
Confirm that the Do not record and run on browsers that are already open and Close the browser when the test is closed options are selected.
➤ In the Windows Applications tab, confirm that Record and run on these applications (opened on session start) is selected, and that there are no applications listed.
Click OK.
QuickTest begins recording, and your browser opens to the Mercury Tours Web site.
3 Sign in to the Mercury Tours Web site.
In the User Name and Password boxes, type the name and password you registered with Mercury Tours.
Click Sign-In.
The Flight Finder page opens.
4 Enter flight details.
Change the following selections:
➤ Departing From: New York
➤ On: Dec 29
➤ Arriving In: San Francisco
➤ Returning: Dec 31
Click CONTINUE to accept the other default selections. The Select Flight page opens.
5 Select a flight.
Click CONTINUE to accept the default flight selections. The Book a Flight page opens.
6 Enter required passenger and purchase information.
Enter the required information (fields with red text labels) in the Passengers and Credit Card sections.
At the bottom of the page, click SECURE PURCHASE. The Flight Confirmation page opens.
7 Return the browser to the Flight Finder page.
At the bottom of the Flight Confirmation page, click BACK TO FLIGHTS button. The Flight Finder page opens.
Ending the recording on the Flight Finder page enables you to create an action that starts and ends on the same page, so that you can call the action multiple times if you wish.
8 Stop Recording.
In QuickTest, click Stop to stop the recording process.
9 Save the test as ActionA.
Select File > Save As. Save the test as ActionA.
Dividing the Test into Two Actions
Since your test currently contains two main processes: signing-in and purchasing a flight, it makes sense to divide the test into separate actions.
1 Select the page where you want the second action to begin.
In the Keyword View, expand (+) Action1 > Welcome: Mercury Tours.
2 Split the test into two actions.
Select the first Find a Flight: Mercury page and choose Step > Split Action or click the Split Action button. The Split Action dialog box opens.
1 Select the page where you want the second action to begin.
In the Keyword View, expand (+) Action1 > Welcome: Mercury Tours.
2 Split the test into two actions.
Select the first Find a Flight: Mercury page and choose Step > Split Action or click the Split Action button. The Split Action dialog box opens.
3 Enter names and descriptions for the two actions.
In the Name box of the 1st action type: Sign_in.
In the Description box of the 1st action, type: Enters user name and password to sign in.
In the Name box of the 2nd action type: FlightOrder.
In the Description box of the 2nd action, type: Chooses and purchases a flight.
Click OK to close the Split Action dialog box and accept the other default selections. The two actions are displayed in the Keyword View.
Choose View > Expand All to examine the contents of each action. Note that the FlightOrder action begins and ends with the Find a Flight: Mercury page.
In the Name box of the 1st action type: Sign_in.
In the Description box of the 1st action, type: Enters user name and password to sign in.
In the Name box of the 2nd action type: FlightOrder.
In the Description box of the 2nd action, type: Chooses and purchases a flight.
Click OK to close the Split Action dialog box and accept the other default selections. The two actions are displayed in the Keyword View.
Choose View > Expand All to examine the contents of each action. Note that the FlightOrder action begins and ends with the Find a Flight: Mercury page.
Inserting a Call to a New Action
Now you will insert a call to a new action and record the step of returning to the Mercury Tours home page so that the entire test begins and ends on the same page.
1 Insert the ReturnHome action.
Choose Insert > Call to New Action or click the Insert Call to New Action button. The Insert Call to New Action dialog box opens.
Enter ReturnHome in the Name box, confirm that At the end of the test is selected, and click OK. The dialog box closes and the ReturnHome action is added to the end of your test.
1 Insert the ReturnHome action.
Choose Insert > Call to New Action or click the Insert Call to New Action button. The Insert Call to New Action dialog box opens.
Enter ReturnHome in the Name box, confirm that At the end of the test is selected, and click OK. The dialog box closes and the ReturnHome action is added to the end of your test.
2 Prepare the application for recording.
Confirm that your Web browser is open to the Flight Finder page.
If your browser is not open, open it to the Mercury Tours site (http://newtours.mercuryinteractive.com) and sign in. The Flight Finder page opens.
Position the applications on your desktop so that you can see both QuickTest and the Web browser.
3 Change the Record and Run settings.
Currently, your Record and Run settings are set so that a new browser opens each time you begin recording your test. However, because you want to record a step on a browser that you have already opened and prepared, you need to change the Record and Run settings before you begin recording.
In QuickTest, choose Test > Record and Run Settings. The Record and Run Settings dialog box opens.
Confirm that your Web browser is open to the Flight Finder page.
If your browser is not open, open it to the Mercury Tours site (http://newtours.mercuryinteractive.com) and sign in. The Flight Finder page opens.
Position the applications on your desktop so that you can see both QuickTest and the Web browser.
3 Change the Record and Run settings.
Currently, your Record and Run settings are set so that a new browser opens each time you begin recording your test. However, because you want to record a step on a browser that you have already opened and prepared, you need to change the Record and Run settings before you begin recording.
In QuickTest, choose Test > Record and Run Settings. The Record and Run Settings dialog box opens.
In the Web tab, select Record and run test on any open Web browser and click OK.
4 Record the ReturnHome action.
In the Keyword View, select the new ReturnHome action icon.
Choose Test > Record or click the Record button.
Click the Home navigation link on the left side of the Flight Finder page.
The Mercury Tours home page opens.
In QuickTest, click Stop to stop the recording process.
5 Return the Record and Run Settings to their original settings.
You changed the record and run settings for the purposes of recording the ReturnHome action, but this change also affects the way QuickTest runs the test. You want QuickTest to open a new browser to the Mercury Tours home page when you run the test, so you need to reapply the original settings.
Choose Test > Run and Record Settings. The Record and Run Settings dialog box opens.
In the Web tab, select Open the following browser when a record or run session begins. Confirm that http://newtours.mercuryinteractive.com is displayed in the Address box and click OK.
6 Save the test.
Choose File > Save or click the Save button.
4 Record the ReturnHome action.
In the Keyword View, select the new ReturnHome action icon.
Choose Test > Record or click the Record button.
Click the Home navigation link on the left side of the Flight Finder page.
The Mercury Tours home page opens.
In QuickTest, click Stop to stop the recording process.
5 Return the Record and Run Settings to their original settings.
You changed the record and run settings for the purposes of recording the ReturnHome action, but this change also affects the way QuickTest runs the test. You want QuickTest to open a new browser to the Mercury Tours home page when you run the test, so you need to reapply the original settings.
Choose Test > Run and Record Settings. The Record and Run Settings dialog box opens.
In the Web tab, select Open the following browser when a record or run session begins. Confirm that http://newtours.mercuryinteractive.com is displayed in the Address box and click OK.
6 Save the test.
Choose File > Save or click the Save button.
Setting Actions as Reusable Actions
Reusable actions are like functions in programming. When you have a process that you may need to include in several tests, you record, modify, and enhance the steps of the process and save them in a reusable action.
Then you can call the action from other tests, rather than recording, modifying, and enhancing the same steps each time.
To call an action from another test, you must make it a reusable action in the test with which it was stored. The Sign_in and ReturnHome action you created in this lesson can apply to almost any test you might create on the Mercury Tours site, so it makes sense to make them reusable actions.
1 Make the Sign_in action reusable.
In the Keyword View, right-click the Sign_in action and choose Action Properties. The Action Properties dialog box opens. Select the Reusable action check box and click OK. If a message box is displayed, read the message, click Do not show this dialog box again, and click OK. The action icon changes to a reusable action icon.
2 View the details of the Sign_in action.
Note that you no longer have the option to expand the Sign_in action within the Keyword View.
If the Action List was not previously displayed above the Keyword View, it is displayed after you convert the action to a reusable action. The Action List displays a list of all reusable and external actions in the test.
Then you can call the action from other tests, rather than recording, modifying, and enhancing the same steps each time.
To call an action from another test, you must make it a reusable action in the test with which it was stored. The Sign_in and ReturnHome action you created in this lesson can apply to almost any test you might create on the Mercury Tours site, so it makes sense to make them reusable actions.
1 Make the Sign_in action reusable.
In the Keyword View, right-click the Sign_in action and choose Action Properties. The Action Properties dialog box opens. Select the Reusable action check box and click OK. If a message box is displayed, read the message, click Do not show this dialog box again, and click OK. The action icon changes to a reusable action icon.
2 View the details of the Sign_in action.
Note that you no longer have the option to expand the Sign_in action within the Keyword View.
If the Action List was not previously displayed above the Keyword View, it is displayed after you convert the action to a reusable action. The Action List displays a list of all reusable and external actions in the test.
View the details of the Sign_in action by selecting Sign_in from the Action List. The details of the Sign_in action are displayed.
In the Action List, select Test Flow to return to the main flow of the test in the Keyword View.
3 Make the ReturnHome action reusable.
Repeat steps 1 and 2 for the ReturnHome action.
4 Save the test.
Choose File > Save or click the Save button.
In the Action List, select Test Flow to return to the main flow of the test in the Keyword View.
3 Make the ReturnHome action reusable.
Repeat steps 1 and 2 for the ReturnHome action.
4 Save the test.
Choose File > Save or click the Save button.





No comments:
Post a Comment