You are on page 1of 25

Exercise: Using Multiple and Reusable Actions

In this exercise, you create two reusable actions to be called from a main calling action. The activities in this exercise are divided into the following parts: Part 1: Create a reusable log in test. Part 2: Change the default name of an action. Part 3: Create a reusable NewOrder test. Part 5: Create a main calling test.

Part 1: Create a Reusable Log in Test Do not login right now.

1. Ensure that the QuickTest Professional application is open. 2. Open the LOGIN window of the Flight Reservation application. 3. From the QuickTest Professional menu bar, select FILE NEW TEST to open a new test. 4. On the QuickTest Professional toolbar, click RECORD. The RECORD AND RUN SETTINGS dialog box appears. 5. Click OK. 6. In the LOGIN dialog box, type the following information: AGENT NAME: Alex PASSWORD: mercury 7. Click OK. The FLIGHT RESERVATION window appears. 8. On the QuickTest Professional toolbar, click STOP to stop the test. 9. Save the test as LABCH8_1_FLIGHTLOGIN.
Instructor Notes
Ask the students to use the directions and screen shots listed throughout the chapter as guides to perform the exercises.

Exercise: Using Multiple and Reusable Actions Using Multiple and Reusable Actions

8-24

10. Close the FLIGHT RESERVATION window. 11. Select START PROGRAMS QUICKTEST PROFESSIONAL SAMPLE APPLICATIONS FLIGHT. The LOGIN dialog box appears. 12. Run the test and verify that the test passes.

Part 2: Change the Default Name of the Action

1. Ensure that the LABCH8_1_FLIGHTLOGIN test is open. 2. In KEYWORD VIEW, right-click the ACTION1 step and select ACTION PROPERTIES from the menu. The ACTION PROPERTIES dialog box appears. 3. In the ACTION PROPERTIES dialog box, from the GENERAL tab, in the NAME field, replace ACTION1 with FLIGHT_LOGIN. 4. Check the REUSABLE ACTION check box. 5. Click OK. The HINT dialog box appears.

6. In the HINT dialog box, click OK. 7. Save the test.

Part 3: Create a Reusable NewOrder Test


1. Open a new test. 2. Record a new test to insert an order. 3. In QuickTest Professional, in KEYWORD VIEW, right-click the ACTION1 step and select ACTION PROPERTIES from the menu. The ACTION PROPERTIES dialog box appears. 4. In the ACTION PROPERTIES dialog box, from the GENERAL tab, in the NAME field, replace ACTION1 with FLIGHT_NEWORDER. 5. In the DESCRIPTION field, type CREATE A NEW ORDER. 6. Check the REUSABLE ACTION check box. 7. Click OK. 8. In the HINT dialog box, click OK. 9. Save the test as LABCH8_3_NEWORDER.
Using Multiple and Reusable Actions Exercise: Using Multiple and Reusable Actions

8-25

Part 4: Create a Main Calling Test

1. From QuickTest Professional menu bar, select FILE NEW TEST to start a new test. 2. Rename the default ACTION1 as FLTBUSPROCESS. Note: This name is an abbreviation for Flight Business process and this action is not reusable. 3. In the QUICKTEST PROFESSIONAL window, select the FLTBUSPROCESS action. 4. From the QuickTest Professional menu bar, select INSERT CALL TO COPY OF ACTION. The SELECT ACTION dialog box appears. 5. In the SELECT ACTION dialog box, browse, and select the LABCH8_1_FLIGHTLOGIN test. 6. In the ACTION list, ensure that FLIGHT_LOGIN is selected. 7. Ensure that the AFTER THE CURRENT STEP option is selected. 8. Click OK. In KEYWORD VIEW, COPY OF FLIGHT_LOGIN appears. 9. In the KEYWORD VIEW, select the FLTBUSPROCESS action. 10. From the QuickTest Professional menu bar, select INSERT CALL TO COPY OF ACTION. 11. In the SELECT ACTION dialog box, from the FROM TEST list, browse and select the LABCH8_3_NEWORDER test. 12. In the ACTION list, ensure that FLIGHT_NEWORDER is selected.

13. Ensure that the AFTER THE CURRENT STEP option is selected. Note: In KEYWORD VIEW, COPY OF FLIGHT_NEWORDER appears before the FLIGHT_LOGIN test. 14. Drag and drop the FLIGHT_LOGIN action before the FLIGHT_NEWORDER action. 15. Save the test as LABCH8_4_FLTBUSPROCESS. 16. Close the FLIGHT RESERVATION window and then launch the LOGIN window of the application.

Launch just the LOGIN dialog box of the Flight Reservation application. Do not log on.
Exercise: Using Multiple and Reusable Actions Using Multiple and Reusable Actions

8-26

17. Run the test. The test should pass. 18. Close the QuickTest Professional and Flight Reservation applications.

Exercise: Adding Steps Without Recording


Create a test that searches for the LOGIN window. If the window is found, enter the appropriate user name and password and report that the login was successful. If the window is not found, report an error and launch the Flight Reservation application. If the objects for the test application are not available, add them to Object Repository. The activities in this exercise are divided into the following parts: Part 1: Operate on the Login window. Part 2: Add objects to Object Repository. Part 3: Verify that the Login window exists. Part 4: Insert a report step. Part 5: Set the ELSE statement.

Part 1: Operate on the Login Window

1. Open the QuickTest Professional application. 2. From the QuickTest Professional menu bar, select INSERT CONDITIONAL STATEMENT IF ... THEN. The STATEMENT step is added in KEYWORD VIEW. 3. In KEYWORD VIEW, in the ITEM column, click the STATEMENT step. The step changes to a list.

4. From the STATEMENT list, select OBJECT FROM REPOSITORY. The SELECT OBJECT FOR STEP dialog box appears. Note: Leave the SELECT OBJECT FOR STEP dialog box open.

Part 2: Add Objects to Object Repository

1. Open the LOGIN window of the Flight Reservation application. 2. In the SELECT OBJECT FOR STEP dialog box, click the pointing finger button. The cursor changes to a pointing hand.
Instructor Notes
This exercise enables you to add steps to a test without recording.

Exercise: Adding Steps Without Recording Adding Steps Without Recording

9-20

3. Use the pointing hand cursor to click the LOGIN window. The OBJECT SELECTION dialog box appears. 4. In the OBJECT SELECTION dialog box, click OK. This adds the LOGIN object to the object repository tree in the SELECT OBJECT FOR STEP dialog box. 5. Repeat steps 3 and 4 for the AGENT NAME and PASSWORD fields, and for the OK button in the LOGIN dialog box. Note: Verify that all of the objects that you have added appear in the object repository tree in the SELECT OBJECT FOR STEP dialog box. 6. In the object repository tree, select the LOGIN window object. 7. Click OK. The object is added to the IF statement in KEYWORD VIEW.

Part 3: Verify that the Login Window Exists

1. In KEYWORD VIEW, select the LOGIN object. 2. In the OPERATION column, change the operation from ACTIVATE to EXIST. 3. From the QuickTest Professional menu bar, select INSERT NEW STEP. A new step is added. 4. From the list, select AGENT NAME. 5. In the VALUE column, type your first name. 6. Repeat the steps from 3 through 5 to add the password. In step 5, set the password to MERCURY. 7. Repeat the steps 3 and 4 to add the OK button. 8. Save the test as LABCH9_3. 9. Run the test. The test passes.

Part 4: Insert a Report Step

1. In KEYWORD VIEW, select the OK step.

2. From the QuickTest Professional menu bar, select INSERT REPORT. The INSERT REPORT dialog box appears. 3. In the INSERT REPORT dialog box, from the STATUS list, select PASSED.
Adding Steps Without Recording Exercise: Adding Steps Without Recording

9-21 4. In the NAME field, type LOGIN WINDOW FOUND. 5. In the DETAILS field, type THE FLIGHT RESERVATION APPLICATION LOGIN
IS SUCCESSFUL.

6. Click OK. 7. Close the Flight Reservation application and open it again but do not log on. 8. Save the test as LABCH9_4. 9. Run the test. Note: View the test results to see how the REPORTER EVENT reports the test status.

Part 5: Set the Else Statement

1. Close the Flight Reservation application. 2. Run the test again. 3. View the results in the TEST RESULTS window. The test results show that the object does not exist. Note: You must prepare for the case when the LOGIN window is not found. You can use the ELSE statement to handle this situation. 4. In KEYWORD VIEW, select the IF statement. 5. From the QuickTest Professional menu bar, select INSERT CONDITIONAL STATEMENT ELSE. 6. The ELSE statement appears at the end of the test. Click the step with the ELSE statement. The step changes to a list. 7. From the list, select STEP GENERATOR. The STEP GENERATOR dialog box appears. 8. In the STEP GENERATOR dialog box, from the CATEGORY list, select FUNCTIONS. 9. From the LIBRARY list, select ALL. The ALL function library appears. 10. From the OPERATION list, select INVOKEAPPLICATION. 11. In the ARGUMENTS section, select the COMMAND row. 12. In the VALUE column, type the absolute path for the Flight Reservation application: C:\PROGRAM FILES\MERCURY INTERACTIVE\QUICKTEST PROFESSIONAL\SAMPLES\FLIGHT\APP\FLIGHT4A.EXE. Exercise: Adding Steps Without Recording 9-22
Adding Steps Without Recording

13. Click OK. 14. Run the test. Note: It takes a few seconds to view the test run. 15. In KEYWORD VIEW, select the last step. 16. From the QuickTest Professional menu bar, select INSERT NEW STEP. A new step is added. 17. From the list, select OBJECT FROM REPOSITORY. The SELECT OBJECT FOR STEP dialog box appears. 18. In the SELECT OBJECT FOR STEP dialog box, in the object repository tree, select the LOGIN window object and click OK. 19. In the KEYWORD VIEW, select the LOGIN step. 20. From the QuickTest Professional menu bar, select INSERT NEW STEP. A new step is added. 21. From the list, select AGENT NAME. 22. In the VALUE column, type LAURENCE. 23. From the QuickTest Professional menu bar, select INSERT NEW STEP. A new step is added. 24. From the list, select PASSWORD. 25. In the VALUE column, type MERCURY. 26. From the QuickTest Professional menu bar, select INSERT NEW STEP. A new step is added. 27. From the list, select OK. 28. Close the LOGIN window. 29. Save the test as LABCH9_5. 30. Run the test. 31. View the test results. Note: Verify that the ELSE statement was executed.
Adding Steps Without Recording Exercise: Adding Steps Without Recording

9-23 32. Close the QuickTest Professional and Flight Reservation applications.

Exercise: Creating a Test on a Web Application


In this exercise, you prepare for, create, and verify a test to test the functionality of the new flight reservation process of the Mercury Tours Web application. In this exercise, you: Verify that a new flight reservation can be made for one to four passengers (hint: standard checkpoint). Verify that the YOUR ITINERARY HAS BEEN BOOKED! text appears on the FLIGHT CONFIRMATION Web page (hint: text checkpoint). Verify that the transaction is successful for three different combinations of cities (hint: parameters). This exercise consists of the following parts: Part 1: Prepare the test environment.

Part 2: Record a test on the Web application. Part 3: Insert a standard checkpoint and a text checkpoint. Part 4: Use parameters to store city names.

Part 1: Prepare the Test Environment

1. Open QuickTest Professional. 2. In the QUICKTEST PROFESSIONAL - ADD-IN MANAGER dialog box, check the WEB check box. 3. Click OK. 4. Open a blank test.
Instructor Notes
This exercise enables students to create a test on a Web application. This exercise includes steps to create a new test on a Web application and insert standard and text checkpoints to verify the object values. In addition, this exercise includes steps to store values in parameters. Ensure the following before you perform this exercise: - Register a user with the user name JOJO and the password BEAN on the Mercury Tours Web application. - Close the QuickTest Professional application, the Flight Reservation application, and any open browsers.

Exercise: Creating a Test on a Web Application Creating Tests on a Web Application

10-14

5. Click START PROGRAMS MERCURY TOURS START SERVER to start the Apache Web server. 6. Verify that the START SERVER window displays the following line: Apache/1.3.17 <Win32> ApacheJServ/1.1.2 running... 7. Minimize the START SERVER window.

8. Click START PROGRAMS MERCURY TOURS MERCURY TOURS. 9. Specify the following user name and password to log on to the Mercury Tours application: Username: JOJO Password: BEAN 10. Click SIGN-IN. Ensure that the FLIGHT FINDER Web page appears. Note: The FLIGHT FINDER Web page is the initial and end condition for creating this test.

Part 2: Record a Test on the Web Application

1. On the QuickTest Professional toolbar, click RECORD. The RECORD AND RUN SETTINGS dialog box appears. 2. Ensure that the RECORD AND RUN TEST ON ANY OPEN BROWSER option is selected and click OK. 3. On the FLIGHT FINDER Web page, specify the following flight information: TYPE: ROUND TRIP PASSENGERS: 4 DEPARTING FROM: NEW YORK ON: JULY 5 ARRIVING IN: PARIS RETURNING: JULY 25 SERVICE CLASS: BUSINESS CLASS AIRLINE: NO PREFERENCE
Creating Tests on a Web Application Exercise: Creating a Test on a Web Application

10-15 4. Click CONTINUE. The SELECT FLIGHT Web page appears. 5. Click CONTINUE to accept the default flight. The BOOK A FLIGHT Web page appears. 6. In the PASSENGERS section, specify the following data: FIRST NAME: JOSEPH LAST NAME: WILLIAMS MEAL: NO PREFERENCE 7. Type other passenger names: NANCY WILLIAMS, JAMES WILLIAMS, and BARBARA WILLIAMS. Set their MEAL to NO PREFERENCE. 8. In the CREDIT CARD section, specify the following data: CARD TYPE: DEFAULT NUMBER: 1234567890 EXPIRATION: 12-2008

9. Click SECURE PURCHASE to book a flight. 10. On the left side of the FLIGHT CONFIRMATION Web page, click the FLIGHTS link to set the initial condition for the test. 11. On the QuickTest Professional toolbar, click STOP. 12. Save the test as LABCH10_2.

Part 3: Insert a Standard Checkpoint and a Text Checkpoint

1. In KEYWORD VIEW, select the PASSCOUNT step that has the value 4 in the VALUE column. 2. From the QuickTest Professional menu bar, select INSERT CHECKPOINT STANDARD CHECKPOINT to verify that a maximum of four passengers are allowed for a new flight reservation. The CHECKPOINT PROPERTIES dialog box appears. 3. Check the ALL ITEMS check box. Uncheck remaining check boxes. 4. Select the AFTER CURRENT STEP option. 5. Click OK. Exercise: Creating a Test on a Web Application 10-16
Creating Tests on a Web Application

6. In KEYWORD VIEW, select the FLIGHT CONFIRMATION: MERCURY step. 7. In ACTIVE SCREEN, select the YOUR ITINERARY HAS BEEN BOOKED! text and right-click the text. 8. Select INSERT TEXT CHECKPOINT. The TEXT CHECKPOINT PROPERTIES dialog box appears. 9. Ensure that the BEFORE CURRENT STEP option is selected. 10. Click OK.

Part 4: Use Parameters to Store City Names

1. In KEYWORD VIEW, click the VALUE column of the FROMPORT step. The CONFIGURE THE VALUE button appears. 2. Click the CONFIGURE THE VALUE button. 3. In the VALUE CONFIGURATION OPTIONS dialog box, select the PARAMETER option. 4. In the NAME field, type FROMPORT. 5. Click OK. 6. Perform steps 1 to 5 for the TOPORT step and name the parameter as TOPORT. 7. In DATA TABLE, type the following names of cities in the FROMPORT column: FRANKFURT LONDON PORTLAND

8. In DATA TABLE, type the following names of cities in the TOPORT column: SEATTLE ZURICH SYDNEY 9. Save the test as LABCH10_4. 10. Run the test and view the test results in the TEST RESULTS window. The test passes. 11. Close the QuickTest Professional application and the Mercury Tours Web browser.

Exercise: Creating a Custom Checkpoint


In this exercise, you create a test to verify that the calculated total cost of tickets purchased for a flight reservation is correct. You use breakpoints to force the outcome of the total amount. You also use breakpoints to verify that the correct reporter message appears, based on the result of the calculation. This exercise consists of the following parts: Part 1: Record a test. Part 2: Create output parameters to calculate variables. Part 3: Use a formula in the DATA TABLE. Part 4: Use a conditional statement to verify the calculation. Part 5: Report status of the PRICECHK parameter. Part 6: Set a breakpoint and create a failure.

Part 1: Record a Test

1. Open the QuickTest Professional and Flight Reservation applications. 2. Record a new reservation that includes the following flight information: a) DATE OF FLIGHT: 12-12-09 b) FLY FROM: Frankfurt c) FLY TO: London d) NAME: Sam Smith e) TICKETS: 2 f) CLASS: First

3. Save the test as LABCH11_1. 4. Run the test. The test playback should be successful.
Instructor Notes
This exercise enables students to create a custom checkpoint. This exercise includes steps to create a new test and insert a new synchronization point. The students use the breakpoint cost of tickets purchased for a flight reservation is correct.

DEBUG tool to verify that the calculated total

Exercise: Creating a Custom Checkpoint Custom Checkpoints

11-16

Part 2: Create Output Parameters to Calculate Variables

1. From KEYWORD VIEW, select the TICKETS step that has the SET value in the OPERATION column. 2. To create an output step for the number of tickets per flight, in the ACTIVE SCREEN, right-click the TICKETS field that is highlighted. 3. Select INSERT OUTPUT VALUE to create an output parameter. The OBJECT SELECTION - OUTPUT VALUE PROPERTIES dialog box appears. 4. Click OK. The OUTPUT VALUE PROPERTIES dialog box appears. 5. Check the TEXT check box and click MODIFY. The OUTPUT OPTIONS dialog box appears. 6. In the NAME field, type NTICKETS. 7. Click OK to close the OUTPUT OPTIONS dialog box. 8. Select the AFTER CURRENT STEP option. 9. Click OK to close the OUTPUT VALUE PROPERTIES dialog box. 10. Verify that: a) A TICKETS step appears in KEYWORD VIEW that has the OUTPUT value in the OPERATION column. b) A column named NTICKETS appears in the GLOBAL sheet of DATA TABLE. 11. From ACTIVE SCREEN, select the PRICE field and perform steps 2 through 10 to create an output parameter NPRICE. 12. From ACTIVE SCREEN, select the TOTAL field and perform steps 2 through 10 to create an output parameter NTOTAL. 13. Double-click the fourth column in the GLOBAL sheet of DATA TABLE that does not have a name. The CHANGE PARAMETER NAME dialog box appears. 14. In the DATA TABLE COLUMN NAME field, type PRICECHK. 15. Click OK. The new column name appears in the DATA TABLE. 16. Save the test as LABCH11_2.
Custom Checkpoints

Exercise: Creating a Custom Checkpoint

Part 3: Use a Formula in the Data Table


1. In the GLOBAL sheet of DATA TABLE, specify test data for the following fields: a) NTICKETS: 1 b) PRICE: 123 c) TOTAL: 123 2. For the first row under the PRICECHK column, type the following formula:
=ROUND(A1*B1,2)=ROUND(C1,2)

11-17

3. To perform the calculation, press ENTER. The TRUE value appears in the PRICECHK column. 4. Change the value of NTICKETS to 2 and press ENTER. The FALSE value appears in the PRICECHK column.

Part 4: Use a Conditional Statement to Verify the Calculation

1. In KEYWORD VIEW, select the TOTAL step that has the OUTPUT value in the OPERATION column. 2. From the QuickTest Professional menu bar, select INSERT STEP GENERATOR. The STEP GENERATOR dialog box appears. 3. In the CATEGORY list, select UTILITY OBJECTS. 4. In the OBJECT list, select DATA TABLE. 5. In the OPERATION list, ensure that VALUE is selected. 6. For the PARAMETERID field, click in the VALUE column and type PRICECHK. 7. Ensure that the RETURN VALUE check box is checked. 8. In the RETURN VALUE field, type VPRICECHK. 9. Click OK to insert this step into the test. 10. From the QuickTest Professional menu bar, select INSERT CONDITIONAL STATEMENT IF ... THEN. 11. Click the VALUE cell of this step and overwrite TRUE with VPRICECHK=TRUE. Exercise: Creating a Custom Checkpoint 11-18
Custom Checkpoints

Part 5: Report Status of the PriceChk Parameter


1. From QuickTest Professional menu bar, select INSERT REPORT. The INSERT REPORT dialog box appears. 2. In the STATUS list, select PASSED. 3. In the NAME field, type TOTAL.

4. In the DETAILS field, type TOTAL WAS CALCULATED SUCCESSFULLY. 5. Click OK. 6. In KEYWORD VIEW, select the IF statement. 7. From the QuickTest Professional menu bar, select INSERT CONDITIONAL STATEMENT ELSE. The ELSE statement line is highlighted. 8. From the QuickTest Professional menu bar, select INSERT REPORT. The INSERT REPORT dialog box appears. 9. In the STATUS list, select FAILED. 10. In the NAME field, type TOTAL. 11. In the DETAILS field, type TOTAL WAS NOT CALCULATED SUCCESSFULLY. 12. Click OK. 13. Save the test as LABCH11_5. 14. Ensure that the AUT is in the initial condition. 15. Run the test and view the test results. 16. In the TEST RESULTS window, check that the REPORTER EVENT step reports the correct status based on the outcome of the test. 17. Verify that the value of PRICECHK is TRUE in RUN-TIME DATA TABLE of the TEST RESULTS window.

Part 6: Set a Breakpoint and Create a Failure

1. In KEYWORD VIEW, select the TOTAL step that has OUTPUT as the value in the OPERATION column. 2. From the QuickTest Professional menu bar, select DEBUG INSERT/REMOVE BREAKPOINT.
Custom Checkpoints Exercise: Creating a Custom Checkpoint

11-19 3. Run the test. When the test run stops at the breakpoint step, change the number of tickets in the GLOBAL sheet of the DATA TABLE to a different number. For example, change the number of tickets from 2 to 5. Note: The number of tickets can be 1-10, inclusive of 1 and 10. 4. On the QuickTest Professional toolbar, click RUN. The test continues to run from the breakpoint step. 5. Open the TEST RESULTS window. The test fails. 6. Expand all steps in the TEST RESULTS window to view the output of the REPORTER step. 7. Check the values in RUN-TIME DATA TABLE to see which values passed. 8. Close the QuickTest Professional and Flight Reservation applications.

Exercise: Creating a Database Checkpoint


In this exercise, you create a test to verify that an order number generated in the Flight Reservation application is inserted into the QT_FLIGHTS32 database. You also verify that the number of tickets ordered matches the number of tickets stored in the QT_FLIGHTS32 database for an order number. This exercise consists of the following parts: Part 1: Create output parameters for order number and tickets. Part 2: Use Microsoft Query to query the ORDERS table. Part 3: Set database checkpoint properties for an order number. Part 4: Set database checkpoint properties for the number of tickets. Part 5: Run the test and view results.

Part 1: Create Output Parameters for Order Number and Tickets


1. Open the QuickTest Professional application. Note: Do not select any add-ins. 2. On the QuickTest Professional toolbar, click NEW. 3. Open and log on to the Flight Reservation application. 4. Record a new reservation that includes the following flight information: a) DATE OF FLIGHT: 12-12-09 b) FLY FROM: Frankfurt c) FLY TO: London d) NAME: Sam Smith e) TICKETS: 2 f) CLASS: First Before performing the following steps, ensure that you are still in the RECORD mode.
Instructor Notes

This exercise enables students to create a database checkpoint. This exercise includes steps to store the value of a field in an output parameter and then verify if the value stored in the parameter matches the actual value stored in the database.

Exercise: Creating a Database Checkpoint Using Database Checkpoints

12-32

5. Click INSERT ORDER.

6. From the QuickTest Professional menu bar, select INSERT SYNCHRONIZATION POINT after the progress bar completes. The cursor changes to a pointed finger. 7. In the FLIGHT RESERVATION window, in the progress bar, click the words INSERT DONE... with the pointed finger cursor. 8. In the OBJECT SELECTION - SYNCHRONIZATION POINT dialog box, click OK. The ADD SYNCHRONIZATION POINT dialog box appears. 9. From the PROPERTY NAME list, select TEXT. 10. In the PROPERTY VALUE field, type "INSERT DONE...". Use quotes around the text INSERT DONE. 11. In the TIMEOUT field, retain the default value. 12. Click OK. 13. In the FLIGHT RESERVATION window, click the NEW ORDER button to set end conditions for the test. 14. On the QuickTest Professional toolbar, click STOP to stop the test. 15. Save the test as LABCH12_1. 16. In KEYWORD VIEW, select the INSERT DONE step. 17. In ACTIVE SCREEN, right-click the ORDER NO field, and select INSERT OUTPUT VALUE to create an output parameter. The OBJECT SELECTION - OUTPUT VALUE PROPERTIES dialog box appears. 18. Click OK. The OUTPUT VALUE PROPERTIES dialog box appears. 19. Check the TEXT check box, and click MODIFY. The OUTPUT OPTIONS dialog box appears. 20. In the NAME field, type GUIORDER_NO. 21. Click OK to close the OUTPUT OPTIONS dialog box. 22. In the OUTPUT VALUE PROPERTIES dialog box, select the AFTER CURRENT
STEP

option. 23. Click OK to close the OUTPUT VALUE PROPERTIES dialog box. 24. Verify that:
Using Database Checkpoints Exercise: Creating a Database Checkpoint

12-33 a) The KEYWORD VIEW has an ORDER NO step that has the OUTPUT value in the OPERATION column. b) The GLOBAL sheet of DATA TABLE has a column named GUIORDER_NO. 25. Repeat steps 17 to 24 to create an output parameter for the number of tickets and name it as NTICKETS.

26. Save the test. 27. Run the test to verify that the new order number and the number of tickets are captured in RUN-TIME DATA TABLE.

Part 2: Use Microsoft Query to Query the Orders Table


1. In KEYWORD VIEW, select the TICKETS step that has the value OUTPUT in the OPERATION column. 2. From the QuickTest Professional menu bar, select INSERT CHECKPOINT DATABASE CHECKPOINT. The DATABASE QUERY WIZARD appears. 3. In the QUERY DEFINITION section, ensure that the CREATE QUERY USING MICROSOFT QUERY option is selected. 4. Check the MAXIMUM NUMBER OF ROWS check box. 5. Set MAXIMUM NUMBER OF ROWS to 5. 6. Ensure that the SHOW ME HOW TO USE MICROSOFT QUERY check box is checked, and click NEXT. 7. In the INSTRUCTIONS FOR MICROSOFT QUERY dialog box, click OK. 8. In the CHOOSE DATA SOURCE dialog box, in the DATABASES list, click QT_FLIGHT32*. Note: The Flight Reservation AUT uses the QT_FLIGHT32* database. 9. Ensure that the USE THE QUERY WIZARD TO CREATE/EDIT QUERIES check box is checked. 10. Click OK. 11. In the QUERY WIZARD - CHOOSE COLUMNS dialog box, in the AVAILABLE
TABLES AND COLUMNS

list, double-click the ORDERS table to display all columns of 12-34

the table.
Exercise: Creating a Database Checkpoint Using Database Checkpoints

12. From the AVAILABLE TABLES AND COLUMNS list, select the columns ORDER_NUMBER, TICKETS_ORDERED, and AGENTS_NAME, and use the right arrow button to add each column to the COLUMNS IN YOUR QUERY list. Click NEXT. 13. In the QUERY WIZARD - FILTER DATA dialog box, click NEXT. 14. In the QUERY WIZARD - SORT ORDER dialog box, from the SORT BY list, select ORDER_NUMBER. 15. Select the DESCENDING option, and click NEXT. 16. In the QUERY WIZARD - FINISH dialog box, click SAVE QUERY. 17. In the SAVE AS dialog box, click SAVE to save the query by the default query name.

The QUERY WIZARD - FINISH dialog box appears. 18. Ensure that the EXIT AND RETURN TO QUICKTEST PROFESSIONAL option is selected. 19. Click FINISH. The DATABASE CHECKPOINT PROPERTIES dialog box displays a table that shows the result set of the SQL query.

Part 3: Set Database Checkpoint Properties for an Order Number

1. In the DATABASE CHECKPOINT PROPERTIES dialog box, click the upper left corner to select all rows in the result set. 2. Click the REMOVE FROM CHECK button to uncheck all rows currently selected. 3. Click the first cell of the ORDER_NUMBER column. 4. Click the ADD TO CHECK button to select the first cell of the ORDER_NUMBER column. 5. In the CONFIGURE VALUE section, select the PARAMETER option, and click the PARAMETER OPTIONS button. 6. In the PARAMETER OPTIONS dialog box, from the NAME list, select GUI_ORDER_NO and click OK. 7. In the DATABASE CHECKPOINT PROPERTIES dialog box, select the AFTER
CURRENT STEP option.

Using Database Checkpoints Exercise: Creating a Database Checkpoint

Part 4: Set Database Checkpoint Properties for the Number of Tickets


1. Click the first cell of the TICKETS column. 2. Click the ADD TO CHECK button to select the first cell of the TICKETS column. 3. In the CONFIGURE VALUE section, select the PARAMETER option, and click the PARAMETER OPTIONS button. 4. In the PARAMETER OPTIONS dialog box, from the NAME list, select NTICKETS and click OK to close the PARAMETER OPTIONS dialog box. 5. Click OK to close the DATABASE CHECKPOINT PROPERTIES dialog box. 6. Save the test as LABCH12_4.

12-35

Part 5: Run the Test and View Results

1. Run the test. The test should succeed. 2. On the QuickTest Professional toolbar, click the RESULTS button to view the test

results. The TEST RESULTS window appears. The test should pass. 3. Close the QuickTest Professional and Flight Reservation applications.

Exercise: Administering an Object Repository


This exercise enables you to create a shared object repository and associate the object repository with a test. This exercise consists of the following parts: Part 1: Create a shared object repository.

Part 2: Associate an object repository.

Part 1: Create a Shared Object Repository


1. Invoke QuickTest Professional. 2. Invoke the Flight Reservation application. 3. From the QuickTest Professional menu bar, select RESOURCES OBJECT REPOSITORY MANAGER. The OBJECT REPOSITORY MANAGER window appears. 4. On the OBJECT REPOSITORY MANAGER toolbar, click the ADD OBJECTS button. The cursor changes to a pointing hand. 5. Click the title bar of the Flight Reservation window with the pointing hand cursor. The OBJECT SELECTION - ADD TO REPOSITORY dialog box appears. 6. Click OK. The ADD OBJECT TO OBJECT REPOSITORY dialog box appears. 7. Ensure that all objects are checked. 8. Click OK. Ensure that the objects are added in the OBJECT REPOSITORY MANAGER window. 9. From the OBJECT REPOSITORY MANAGER menu bar, select FILE SAVE AS. The SAVE SHARED OBJECT REPOSITORY dialog box appears. 10. In the FILE NAME field, type FLIGHT.TSR. 11. Click SAVE. 12. Close OBJECT REPOSITORY MANAGER.
Instructor Notes
This exercise enables students to create a shared object repository and associate the object repository with a test.

Exercise: Administering an Object Repository Object Repository Administration

13-16

Part 2: Associate an Object Repository

1. From the QuickTest Professional menu bar, select RESOURCES OBJECT REPOSITORY. The OBJECT REPOSITORY dialog box appears. 2. On the OBJECT REPOSITORY toolbar, click the ASSOCIATE REPOSITORIES button. The ASSOCIATE REPOSITORIES dialog box appears. 3. Click the ADD REPOSITORY button. The ADD SHARED OBJECT REPOSITORY dialog box appears. 4. Navigate to the directory in which you saved the FLIGHT.TSR file, and open the file. 5. In the ASSOCIATE REPOSITORIES window, in the AVAILABLE ACTIONS list, select ACTION 1, and use the right-arrow button to move the action to the ASSOCIATED ACTIONS list. 6. Click OK. The objects are added in the local object repository. 7. Close the OBJECT REPOSITORY dialog box. 8. Close the QuickTest Professional and Flight Reservation applications.

Exercise: Solving Object Recognition Problems


In this exercise, you solve problems related to object recognition in a test by creating virtual objects and by using analog recording. In addition, you create a bitmap checkpoint to compare the expected image to the actual image. This exercise consists of the following parts: Part 1: Record a test on Microsoft Paint using normal recording.

Part 2: Identify the problems in the test. Part 3: Create a virtual object.

Part 4: Perform analog recording. Part 5: Add a bitmap checkpoint.

Part 1: Record a Test on Microsoft Paint Using Normal Recording


1. Open a new test in QuickTest Professional. 2. Select START PROGRAMS ACCESSORIES PAINT to open the Paint application. 3. On the Paint toolbar, ensure that the pencil button is selected. 4. In the drawing area, write QTP. 5. On the QuickTest Professional toolbar, click RECORD. In the RECORD AND RUN SETTINGS dialog box, click OK to accept the default settings. 6. From the Paint menu bar, select FILE NEW. 7. Click NO when prompted to save the drawing. 8. From the color palette, select a color. 9. In the drawing area, write QTP. 10. From the color palette, select a new color. 11. In the drawing area, write QTP.
Instructor Notes
This exercise enables students to use analog recording and solve object recognition problems in a test.

Object Recognition Problems and Solutions Exercise: Solving Object Recognition Problems

14-19 12. On the QuickTest Professional toolbar, click STOP. 13. Save the test as LABCH14_1. 14. On the QuickTest Professional toolbar, click RUN. Click OK to accept the RUN settings.

Part 2: Identify the Problems in the Test

1. Observe the drawing area in the Paint application. The text QTP appears distorted in the drawing area. 2. From the QuickTest Professional menu bar, select RESOURCES OBJECT REPOSITORY. In the OBJECT REPOSITORY tree, observe that QuickTest learns the properties of only two objects, AFX: 1000000:8 and COLORS. QuickTest does not learn the properties of the pencil button separately. 3. Close the OBJECT REPOSITORY dialog box. 4. Observe KEYWORD VIEW. QuickTest does not record the mouse movement. It records the values for the SELECT, CLICK, DRAG, and DROP operations.

Part 3: Create a Virtual Object

1. On the QuickTest Professional menu bar, select TOOLS VIRTUAL OBJECTS

NEW VIRTUAL OBJECT to open VIRTUAL OBJECT WIZARD. The WELCOME TO THE VIRTUAL OBJECT WIZARD page appears. 2. Click NEXT. The MAP TO A STANDARD CLASS page appears. 3. From the CLASS list, select BUTTON. 4. Click NEXT. The MARK VIRTUAL OBJECT page appears. 5. Click MARK OBJECT. The cross-hairs cursor appears. 6. On the Paint application, use the cross-hairs symbol to draw a square around the pencil button. The width and height of the selected region appear in the WIDTH and HEIGHT fields on the MARK VIRTUAL OBJECT page. 7. Click NEXT. The OBJECT CONFIGURATION page appears. 8. In the IDENTIFY OBJECT USING section, ensure that the PARENT ONLY option is selected. 9. Click NEXT. The SAVE VIRTUAL OBJECT page appears. 10. In the NAME field, type PENCIL. Exercise: Solving Object Recognition Problems 14-20
Object Recognition Problems and Solutions

11. In the COLLECTION NAME box, type PAINT. 12. Select the YES option. 13. Click NEXT. The MAP TO A STANDARD CLASS page appears. 14. From the CLASS list, select TABLE. 15. In the NUMBER OF ROWS box, type 2. 16. In the NUMBER OF COLUMNS box, type 14. 17. Click NEXT. 18. On the MARK VIRTUAL OBJECT page that appears, click MARK OBJECT. 19. Use the cross-hairs cursor to draw a rectangle around the color palette in the Paint application. 20. Click NEXT. The OBJECT CONFIGURATION page appears. 21. Ensure that the PARENT ONLY option is selected, and click NEXT. The SAVE VIRTUAL OBJECT page appears. 22. In the NAME field, type COLOR. 23. In the COLLECTION NAME box, ensure that PAINT is selected. 24. Ensure that the NO option is selected. 25. Click FINISH.

Part 4: Perform Analog Recording

1. Open a new test in QuickTest Professional, and save it as LABCH14_4. 2. On the QuickTest Professional toolbar, click RECORD. Click OK to accept the default record and run settings. 3. From the Paint menu bar, select FILE NEW. 4. Click NO when prompted to save the existing drawing.

5. From the QuickTest Professional menu bar, select AUTOMATION ANALOG RECORDING. The ANALOG RECORDING SETTINGS dialog box appears. 6. In the ANALOG RECORDING SETTINGS dialog box, select RECORD RELATIVE
TO THE FOLLOWING WINDOW.

Object Recognition Problems and Solutions Exercise: Solving Object Recognition Problems

14-21 7. Click the pointing hand button, and click the Paint application. 8. In the ANALOG RECORDING SETTINGS dialog box, click START ANALOG RECORD. 9. On the Paint toolbar, ensure that the pencil button is selected. 10. On the color palette, click a color. 11. In the drawing area of the Paint application, write QTP. 12. In the Paint application, from the color palette, select a new color. 13. In the drawing area of the Paint application, write QTP. 14. From the QuickTest Professional menu bar, select AUTOMATION ANALOG RECORDING to stop the analog recording. 15. On the QuickTest Professional toolbar, click STOP. 16. Save the test and run it. The test runs successfully.

Part 5: Add a Bitmap Checkpoint

1. In KEYWORD VIEW, select the step that has the value RUNANALOG in the OPERATION column. 2. On the QuickTest Professional toolbar, click RECORD. 3. Select INSERT CHECKPOINT BITMAP CHECKPOINT. A pointing hand cursor appears. 4. Use the pointing hand cursor to click the bitmap drawn in the Paint application. The OBJECT SELECTION - BITMAP CHECKPOINT PROPERTIES dialog box appears. 5. Click OK to close the OBJECT SELECTION - BITMAP CHECKPOINT PROPERTIES dialog box. 6. Click OK to close the BITMAP CHECKPOINT PROPERTIES dialog box. 7. On the QuickTest Professional toolbar, click STOP. 8. Run the test. The test runs successfully. 9. Close the Paint and QuickTest Professional applications.

Exercise: Creating a Recovery Scenario for a Test


In this exercise, you introduce an error in a test and then use RECOVERY SCENARIO MANAGER to handle the error during a test run. This exercise consists of the following parts: Part 1: Use parameters to store input values for month and year.

Part 2: Run the test to check the error in the test. Part 3: Add a recovery scenario to the test. Part 4: Run the test and view test results.

Part 1: Use Parameters to Store Input Values for Month and Year
1. Open QuickTest Professional. 2. In the QUICKTEST PROFESSIONAL - ADD-IN MANAGER dialog box, check the WEB check box. 3. Click OK. 4. Open the LABCH10_2 test that you created in Chapter 10, Creating Tests on a Web Application, Exercise: Creating Tests on a Web Application. 5. Save the test as LABCH16_1. 6. In KEYWORD VIEW, expand the BOOK A FLIGHT: MERCURY step. 7. In KEYWORD VIEW, click the VALUE column of the CC_EXP_DT_MN step to store the value of month in a parameter. The CONFIGURE THE VALUE button appears. 8. Click the CONFIGURE THE VALUE button. 9. In the VALUE CONFIGURATION OPTIONS dialog box, select the PARAMETER option. 10. In the NAME field, type MONTH.
Instructor Notes
This exercise enables students to create a recovery scenario to handle an exception in a test. This exercise includes steps to introduce an error in a test. It also includes steps to create a recovery scenario to handle the error during a test run.

Using Recovery Scenarios Exercise: Creating a Recovery Scenario for a Test

15-19

11. Click OK. 12. Perform steps 7 to 11 for the CC_EXP_DT_YR step to store the value of year in the YEAR parameter. 13. In DATA TABLE, append the following data in the MONTH column:

11 10
14. In DATA TABLE, append the following data in the YEAR column: 2005 2003 15. Save the test.

Part 2: Run the Test to Check the Error in the Test


1. Select START PROGRAMS MERCURY TOURS START SERVER to start the Apache Web server. Note: You start the Apache Web server to run the Web application. Select START PROGRAMS MERCURY TOURS STOP SERVER to stop the Apache Web server. 2. Select START PROGRAMS MERCURY TOURS MERCURYTOURS to launch the Mercury Tours Web application. 3. Log on to the Mercury Tours Web application using: Username: JOJO Password: BEAN Note: The FLIGHT FINDER Web page is the initial and end condition for this test. Ensure that the FLIGHT FINDER Web page appears. 4. Run the test. The message YOU HAVE ENTERED 2003 AS EXPIRATION YEAR! appears. Note: Do not close the message box. 5. A RUN ERROR message box appears. On the RUN ERROR message, click STOP. Exercise: Creating a Recovery Scenario for a Test 15-20
Using Recovery Scenarios

Part 3: Add a Recovery Scenario to the Test

1. Restore the QuickTest Professional window. 2. From the QuickTest Professional menu bar, select RESOURCES RECOVERY SCENARIO MANAGER. The RECOVERY SCENARIO MANAGER dialog box appears. 3. In the SCENARIOS section, click the NEW SCENARIO button to display RECOVERY SCENARIO WIZARD. 4. Click NEXT. The SELECT TRIGGER EVENT page appears. 5. On the SELECT TRIGGER EVENT page, ensure that the POP-UP WINDOW option is selected. 6. Click NEXT. The SPECIFY POP-UP WINDOW CONDITIONS page appears. 7. Click the pointing hand button, and then click the pop-up error message box that

appears in the Mercury Tours Web application. 8. On the SPECIFY POP-UP WINDOW CONDITIONS page, click NEXT. The RECOVERY OPERATIONS page appears. 9. Click NEXT to define a recovery operation. 10. Ensure that the KEYBOARD OR MOUSE OPERATION option is selected. Click NEXT. 11. On the RECOVERY OPERATION - CLICK BUTTON OR PRESS KEY page, select the CLICK BUTTON WITH LABEL option. 12. Click the pointing hand button, and then click OK on the pop-up error message box that appears in the Mercury Tours Web application. 13. Click NEXT. The RECOVERY OPERATIONS page appears. 14. Clear the ADD ANOTHER RECOVERY OPERATION check box. 15. Click NEXT. The POST-RECOVERY TEST RUN OPTIONS page appears. 16. Select the PROCEED TO NEXT STEP test run option. 17. Click NEXT. The NAME AND DESCRIPTION page appears. 18. In the SCENARIO NAME field, type CREDIT CARD DATE ERROR. 19. In the DESCRIPTION field, type AN INVALID DATE WAS ENTERED IN THE
CREDIT CARD DATE FIELD.

Using Recovery Scenarios Exercise: Creating a Recovery Scenario for a Test

15-21 20. Click NEXT. The COMPLETING THE RECOVERY SCENARIO WIZARD page appears. 21. Check the ADD SCENARIO TO CURRENT TEST check box. 22. Click FINISH. The RECOVERY SCENARIO MANAGER dialog box displays the CREDIT CARD DATE ERROR scenario under the SCENARIOS section. 23. Click SAVE and save the recovery scenario file as DATE_ERROR.QRS. 24. In the RECOVERY SCENARIO MANAGER dialog box, click CLOSE. 25. Save the test as LABCH16_3.

Part 4: Run the Test and View Test Results

1. In the Mercury Tours Web application, on the pop-up error message box, click OK to close the message box. 2. Click the FLIGHTS link to set the initial conditions. 3. In QuickTest Professional, run the test and examine the test results in the TEST RESULTS window to see how QuickTest uses the recovery scenario during the test run. 4. Close QuickTest Professional.
Exercise: Creating a Recovery Scenario for a Test

You might also like