Sie sind auf Seite 1von 53

QuickTest Professional 9.

0
Exercises
Exercise: Preparing the Test Environment
Use the Windows-based Flight Reservation application to prepare for recording.
Before creating a test, set up the test environment and get familiar with the
application under test. Use the best practices to prepare for and implement your
automated test. This exercise is divided into following parts.

Part 1: Launch QuickTest Professional 9.0.

Part 2: Set QuickTest test options.

Part 1: Launch QuickTest Professional 9.0


1. Click START > PROGRAMS > QUICKTEST PROFESSIONAL >
QUICKTEST PROFESSIONAL.

2. ENSURE ALL OPTIONS ARE UNCHECKED IN THE ADD-IN MANAGER dialog


box.

3. Click OK.

4. IN THE QUICKTEST PROFESSIONAL window, click BLANK TEST.

Part 2: Set QuickTest Test Options


1. From the QuickTest Professional menu bar, select TOOLS > OPTIONS.

2. IN THE GENERAL tab, click RESTORE LAYOUT to ensure that the layout is
uniform and all panes and toolbars are displayed in their default
positions and sizes.

3. Click the RUN tab.

4. Ensure that the NORMAL option is selected.

5. Ensure that the VIEW RESULTS WHEN RUN SESSION ENDS check box is
unchecked.

6. Ensure that the ALLOW OTHER MERCURY PRODUCTS TO RUN TESTS AND
COMPONENTS check box is unchecked.

7. From the SAVE STEP SCREEN CAPTURE TO RESULTS list, select ON


ERRORS AND WARNINGS.

8. Click OK.

9. CLOSE THE QUICKTEST PROFESSIONAL APPLICATION.


Exercise: Creating a Basic Test
This exercise enables you to record a basic test, run and save the test, and view
results. The activities here are divided into the following parts:

Part 1: Set initial conditions.

Part 2: Record the business process.

Part 3: Save the test.

Part 4: Run the test.

Part 5: View results.

Part 1: Set Initial Conditions


1. Invoke the Flight Reservation application by selecting START >
PROGRAMS > QUICKTEST PROFESSIONAL > SAMPLE APPLICATIONS
> FLIGHT.

2. Log in using the following information:

AGENT NAME: Mercury

PASSWORD: mercury

3. Click OK. The FLIGHT RESERVATION window appears.

4. From the QuickTest Professional menu bar, select FILE > NEW >
TEST.

5. On the QuickTest Professional toolbar, click RECORD. The RECORD


AND RUN SETTINGS dialog box appears.

6. Start and end recording from the FLIGHT RESERVATION window to set
the window as the initial and end condition for the test.

7. Select the RECORD AND RUN TEST ON ANY OPEN WINDOWS-BASED


APPLICATION option.

8. Click OK. Ensure a blinking RECORDING message appears in the


lower right of the QUICKTEST PROFESSIONAL window.

Notice that the QUICKTEST PROFESSIONAL window has resized for recording.
You can move and resize the QUICKTEST PROFESSIONAL window. This
movement does not impact the recording. Position the QUICKTEST
PROFESSIONAL window and the FLIGHT RESERVATION window so that you can
see both.

Part 2: Record the Business Process


1. Click the FLIGHT RESERVATION window to activate it.

2. On the FLIGHT RESERVATION toolbar, click the NEW ORDER icon to set
the initial condition. Notice that a step is added in the KEYWORD VIEW.

3. Specify the following flight data:

DATE: 11-11-09

FLY FROM: DENVER

FLY TO: SEATTLE

4. Click FLIGHTS. The FLIGHTS TABLE appears.

5. On the default choice, click OK.

6. Specify the following:

NAME: SAM SMITH

TICKETS: 2

CLASS: FIRST

7. Click INSERT ORDER. Wait for the progress bar to complete. When the
insertion is complete, the INSERT DONE... message appears.

8. On the FLIGHT RESERVATION toolbar, click the NEW ORDER icon to set
the end condition.

9. On the QuickTest Professional toolbar, click STOP to stop the test.


Part 3: Save the Test
1. In the QUICKTEST PROFESSIONAL window, select FILE> SAVE. The
SAVE TEST dialog box appears.

2. Browse to the directory \QTP90USING\TESTS.

3. In the FILE NAME field, type LABCH3_3.

4. Click SAVE.

For training purposes, a directory tree was set up on one of your local drives
under \QTP90USING\TESTS. Save all your tests in this directory.

Part 4: Run the Test


1. On the toolbar, click RUN.

2. Click OK to use the TEMPORARY RUN RESULTS FOLDER.

3. Observe the run of the business process.

Part 5: View Results


1. After the test run completes, on the QuickTest Professional toolbar, click
the RESULTS button.

2. From the tree on the left side of TEST RESULTS window, right-click the
TEST <TEST> SUMMARY node and select EXPAND ALL.

3. View the results.

4. CLOSE THE TEST RESULTS window and QuickTest Professional.


Exercise: Using the Object Repository
This exercise enables you to record a new test and use the various features of
the OBJECT REPOSITORY dialog box. The activities in this exercise are divided
into the following parts:

Part 1: Record a new order.

Part 2: Open the OBJECT REPOSITORY dialog box.

Part 3: Change the logical name of an object.

Part 4: Use the Object Spy feature.

Part 5: Use the Highlight feature.

Part 6: Use the Locate in Repository feature.

Part 7: Add a new object.

Part 1: Record a New Order


1. Ensure that the QuickTest Professional and Flight Reservation
applications are open on your computer.

2. In the QuickTest Professional menu bar, select FILE > NEW > TEST.

3. Click RECORD. The RECORD AND RUN SETTINGS dialog box appears.

4. In the RECORD AND RUN SETTINGS dialog box, click OK.

5. In the FLIGHT RESERVATION window toolbar, click NEW ORDER


button to set the initial condition.

6. Enter the following flight data:

DATE OF FLIGHT: 12-12-09

FLY FROM: Frankfurt

FLY TO: London

7. Click Flights. The FLIGHTS TABLE appears.

8. Click OK to accept the default choice.


9. Enter the following purchase data:

NAME: Maura

TICKETS: 2

CLASS: First

10. Click NEW ORDER.

11. On the FLIGHT RESERVATION window toolbar, click NEW ORDER to


set end conditions.

12. On the QuickTest Professional toolbar, click STOP to end the


recording session.

13. Save the test as LABCH4_1.

Part 2: Open the Object Repository Dialog Box


From the QuickTest Professional menu bar, select RESOURCES > OBJECT
REPOSITORY. Now, answer a few questions to check your knowledge.

1. How many objects can you identify in the Object Repository?

Answer: 11 or 12 if the OK button is counted.


FLIGHT RESERVATION, FIRST, DATE OF FLIGHT, TICKETS, NAME, FLY TO, FLY
FROM, INSERT ORDER, FLIGHT, BUTTON, FLIGHTS TABLE, and OK.

2. How many different classes of objects can you identify?

Answer: Seven
FLIGHT RESERVATION, FIRST, DATE OF FLIGHT, (TICKETS and NAME), (FLY TO
and FLY FROM), (INSERT ORDER, FLIGHT, and BUTTON), and FLIGHTS TABLE.

3. How many objects of the class WinButton are shown?

Answer: Three (or four if the OK button is counted).


INSERT ORDER, FLIGHT, and BUTTON.

After you are done, close the OBJECT REPOSITORY dialog box.
Part 3: Change the Logical Name of an Object
1. From the QuickTest Professional menu bar, select RESOURCES >
OBJECT REPOSITORY. The OBJECT REPOSITORY dialog box appears.

2. In the OBJECT REPOSITORY tree, right-click the BUTTON object.

3. From the menu, select RENAME.

4. TYPE THE NEW NAME AS NEW ORDER.

5. Press ENTER.

6. CLOSE THE OBJECT REPOSITORY dialog box.

7. Save the test as LABCH4_3.

Part 4: Use the Object Spy Feature


1. Ensure that the FLIGHT RESERVATION window is open.

2. On the QuickTest Professional toolbar, click the OBJECT SPY button.


The OBJECT SPY dialog box appears.

3. In the OBJECT SPY dialog box, click the pointing finger button. The
mouse cursor changes to a pointing finger.

4. In the FLIGHT RESERVATION window, click the NAME field with the
pointed finger cursor. The OBJECT SPY dialog box shows the object
properties for the NAME field.

5. Document the following object property values:

CLASS NAME ______________________

ENABLED ______________________

ATTACHED TEXT _____________________

NATIVECLASS ______________________
The answers in order are:

WINEDIT, TRUE, NAME, EDIT

6. Close the OBJECT SPY dialog box.

Part 5: Use the Highlight Feature


1. Ensure that the LABCH4_3 test and the FLIGHT RESERVATION window
are open.

2. From the QuickTest Professional menu bar, select RESOURCES >


OBJECT REPOSITORY. The OBJECT REPOSITORY dialog box appears.

3. In the OBJECT REPOSITORY tree, select the NEW ORDER object.

4. Click the HIGHLIGHT IN APPLICATION button.

5. Observe the FLIGHTS RESERVATION window. What did you observe?

Answer: A temporary frame blinks around the NEW ORDER icon in the
FLIGHT RESERVATION window.

Part 6: Use the Locate in Repository Feature


1. On the OBJECT REPOSITORY toolbar, click the LOCATE IN REPOSITORY
button. The cursor changes to a pointing hand.

2. In the FLIGHTS RESERVATION window, use the pointing hand cursor to


point to the NEW ORDER button and click the NEW ORDER button. The
SELECT AN OBJECT dialog box appears.

3. Click OK. What did you observe?

Answer: The NEW ORDER object is highlighted in the OBJECT REPOSITORY


dialog box.

Part 7: Add a New Object


1. In the OBJECT REPOSITORY tree, select the FLIGHT object.

2. On the Object Repository toolbar, click the DEFINE NEW TEST OBJECT
button. The DEFINE NEW TEST OBJECT dialog box appears.

Alternatively, select OBJECT > DEFINE NEW TEST OBJECT.

3. From the ENVIRONMENT list, select STANDARD WINDOWS.


4. From the CLASS list, select WINBUTTON.

5. In the NAME field, type OK.

6. In the TEST OBJECT DETAILS section, click the VALUE column for the
TEXT property, and type OK.

7. Click ADD to add the new test object to the local object repository.

8. Click CLOSE to close the DEFINE NEW TEST OBJECT dialog box. A new
object is added under the FLIGHT object.

9. Close the OBJECT REPOSITORY dialog box.

10. Save the test as LABCH4_7.

11. Close the QuickTest Professional and Flight Reservation applications.


Exercise: Adding Synchronization
You need to cause a test to fail by changing the default timeout setting. View
the error that occurs because of this change, and correct it to ensure a successful
test run. This exercise enables you to add synchronization to your tests. This
exercise is divided into the following parts:

Part 1: Change default synchronization timeout for a test.

Part 2: Run the modified test.

Part 3: Correct the error by inserting a synchronization point.

Part 1: Change Default Synchronization Timeout for a


Test
1. Invoke the QuickTest Professional and Flight Reservation applications.

2. From the QuickTest Professional menu bar, select FILE > NEW > TEST
to open a new test.

3. On the QuickTest Professional toolbar, click the SETTINGS button.

4. In the TEST SETTINGS dialog box that appears, click the RUN tab.

5. In the OBJECT SYNCHRONIZATION TIMEOUT field, lower the


synchronization time from the default to 3 seconds.

6. Click OK.

7. On the QuickTest Professional toolbar, click RECORD.

8. In the RECORD AND RUN SETTINGS dialog box, click OK.

9. On the Flight Reservation toolbar, click the NEW ORDER icon to set
initial conditions for the test.

10. Type the following flight data:

DATE OF FLIGHT: 12-12-09

FLY FROM: Frankfurt

FLY TO: London

11. Click FLIGHTS. The FLIGHTS TABLE appears.


12. Click OK to accept the default choice.

13. Type the following purchase data:

NAME: MAURA

TICKETS: 2

Class: FIRST

14. Click INSERT ORDER.

15. Wait until the INSERT DONE... message appears.

16. On the Flight Reservation toolbar, click NEW ORDER to set end
conditions.

17. On the QuickTest Professional toolbar, click STOP to stop recording.

18. Save the test as LABCH5_1.

Part 2: Run the Modified Test


1. On the QuickTest Professional toolbar, click RUN.

2. In the RUN dialog box, ensure that the TEMPORARY RUN RESULTS FOLDER
option is selected.

3. Click OK. The test should fail. A RUN ERROR message box appears.

4. Notice the type of error message and close the RUN ERROR message box.
Error is: OBJECT IS DISABLED

Part 3: Correct the Error by Inserting a Synchronization


Point
1. Ensure that the LABCH5_1 test is open and save it as LABCH5_3.

2. In KEYWORD VIEW, select the INSERT ORDER step.

3. On the QuickTest Professional toolbar, click RECORD.

4. To insert a synchronization point on the progress bar, from the menu bar,
select INSERT> SYNCHRONIZATION POINT. The cursor changes to a
pointed finger.
5. In the progress bar, click the words INSERT DONE... with the pointed
finger cursor. The OBJECT SELECTION - SYNCHRONIZATION POINT dialog
box appears.

6. In the OBJECT SELECTION - SYNCHRONIZATION POINT dialog box, click


OK. The ADD SYNCHRONIZATION POINT dialog box appears.

7. From the PROPERTY NAME list, select TEXT.

8. In the PROPERTY VALUE field, type "INSERT DONE...".

9. Retain the default timeout of 10000 milliseconds.

10. Click OK.

11. On the QuickTest Professional toolbar, click STOP to stop recording.

12. Save the test.

13. On the QuickTest Professional toolbar, click RUN to run the test. The
RUN dialog box appears.

14. Click OK to close the RUN dialog box. The test should succeed.

15. On the QuickTest Professional toolbar, click the RESULTS icon to view
the test results. The TEST RESULTS window appears.

16. View the test results and close the TEST RESULTS window.

17. Close the test.


Exercise: Adding Checkpoints
Create a basic test and add STANDARD checkpoint to enhance it. Use a regular
expression to make the test more flexible. The activities in this exercise are
divided into the following parts:

Part 1: Insert a standard checkpoint.

Part 2: Check the test results.

Part 3: Modify the test.

Part 4: Record and open a Fax Order test.

Part 5: Add a comment.

Part 6: Run the test.

Part 7: Modify and run the test.

Part 8: Fix the test.

Part 1: Insert a Standard Checkpoint


1. In QuickTest Professional, open a new test.

2. Ensure that the FLIGHT RESERVATION window is open.

3. On the QuickTest Professional toolbar, click RECORD. The RECORD AND


RUN SETTINGS dialog box appears.

4. Click OK to close the he RECORD AND RUN SETTINGS dialog box.

5. In the FLIGHT RESERVATION window, click the NEW ORDER button to


set the initial condition.

6. Enter the following flight data:

DATE OF FLIGHT: 11-11-09

FLY FROM: Denver

FLY TO: Seattle

7. Click the FLIGHTS button. The FLIGHTS TABLE dialog box appears.

8. In the FLIGHTS TABLE dialog box, click OK to accept the default choice.
9. Enter the following information:

NAME: Sam Smith

TICKETS: 2

CLASS: FIRST

10. Click the Insert Order button. Wait for the progress bar to complete and
for the words INSERT DONE... to appear.

11. In the QUICKTEST PROFESSIONAL window, select INSERT >


CHECKPOINT > STANDARD CHECKPOINT. The cursor changes to a
pointing hand.

12. In the FLIGHT RESERVATION window, in the progress bar, click the
words INSERT DONE... with the pointing hand cursor. The OBJECT
SELECTION - CHECKPOINT PROPERTIES dialog box appears.

13. In the OBJECT SELECTION - CHECKPOINT PROPERTIES dialog box, click


OK. The CHECKPOINT PROPERTIES dialog box appears.

14. In the CHECKPOINT PROPERTIES dialog box, check the TEXT property and
uncheck all other properties.

15. Click OK.

16. IN THE FLIGHT RESERVATION toolbar, click the NEW ORDER button to
set end condition for the test.

17. On the QuickTest Professional toolbar, click STOP to stop the test.

18. Save the test as LABCH6_1.

Part 2: Check the Test Results


1. On the QuickTest Professional toolbar, click RUN to run the test.

2. In the RUN dialog box, click OK. The TEST RESULTS window appears.

3. In the TEST RESULTS window, expand the TEST SUMMARY tree. Ensure
that a checkpoint is used to verify that the INSERT DONE step is
successful. The TEST RESULTS SUMMARY displays the STATUS as
PASSED with a value of 1.

4. Close the TEST RESULTS window.


Part 3: Modify the Test
1. In KEYWORD VIEW, select the last BUTTON step that appears.

2. In ACTIVE SCREEN, the ORDER NO: field must show the number
generated after the insert done operation.

3. In ACTIVE SCREEN, right-click the ORDER NO: field (not on static text)
and select INSERT STANDARD CHECKPOINT. The OBJECT SELECTION -
CHECKPOINT PROPERTIES dialog box appears.

4. In the OBJECT SELECTION - CHECKPOINT PROPERTIES dialog box, click


OK.

5. In the CHECKPOINT PROPERTIES dialog box, uncheck all the check


boxes except TEXT.

6. Ensure that when you select the TEXT property, the ORDER NO appears
in the CONSTANT field.

7. Click OK.

8. SAVE THE TEST AS LABCH6_3.

9. On the QuickTest Professional toolbar, click RUN to run the test. The
test should fail.

10. View the test results. The test failed. In the next lab, you will correct
for the failure.

Part 3(a): Add a Regular Expression


1. In QUICKTEST PROFESSIONAL window, in KEYWORD VIEW, select the
ORDER NO step.

2. In the ORDER NO row, select the VALUE column. The CHECKPOINT


PROPERTIES button appears.

3. Click the CHECKPOINT PROPERTIES button. The CHECKPOINT


PROPERTIES dialog box appears.

4. Click the CONSTANT VALUE OPTIONS button beside the CONSTANT


field. The CONSTANT VALUE OPTIONS dialog box appears.

5. In the CONSTANT VALUE OPTIONS dialog box, click the REGULAR


EXPRESSION check box.
6. Type [0-9]+ in the VALUE field and click OK.

7. In the CHECKPOINT PROPERTIES dialog box, click OK.

8. Save test as LABCH6_3_A.

9. On the QuickTest Professional toolbar, click RUN to run the test. The
test should pass.

Part 4: Record and Open a Fax Order Test


1. From the QuickTest Professional menu bar, select FILE > NEW > TEST
to start a new test.

2. Click RECORD. The RECORD AND RUN SETTINGS dialog box appears.

3. In the RECORD AND RUN SETTINGS dialog box, click OK.

4. In the FLIGHT RESERVATION window, click the NEW ORDER button to


set the initial conditions.

5. From the FLIGHT RESERVATION menu bar, select FILE > OPEN ORDER.
The OPEN ORDER window appears.

6. In the OPEN ORDER window, check the ORDER NO. check box.

7. In the ORDER NO. field, type 3.

8. CLICK OK.

9. FROM THE FLIGHT RESERVATION menu bar, select FILE > FAX ORDER.

10. INSERT A STANDARD checkpoint for the SEND SIGNATURE WITH ORDER
check box.

11. In the CHECKPOINT PROPERTIES dialog box, ensure that the CHECKED
check box is checked and has OFF as the value.

12. IN THE CHECKPOINT PROPERTIES dialog box, click OK.

13. IN THE FAX ORDER NO. 3 window, click CANCEL.

14. IN THE FLIGHT RESERVATION window, click the NEW ORDER button to
set end conditions.

15. Stop recording.


Part 5: Add a Comment
1. Maximize the QUICKTEST PROFESSIONAL window.

2. Check whether the COMMENT column is visible in KEYWORD VIEW.

3. If the COMMENT column is not visible, right-click any column name in


KEYWORD VIEW and from the menu, select COMMENT.

4. In KEYWORD VIEW, select the ORDER NO. step.

5. Click the COMMENT column. Type A UNIQUE ORDER IS GENERATED


EVERY TIME YOU INSERT AN ORDER. in the COMMENT column.

6. Save the test as LABCH6_5.

Part 6: Run the Test


1. On the QuickTest Professional toolbar, click RUN to run the test.

2. In the RUN dialog box, click OK.

3. On the QUICKTEST toolbar, click the RESULTS button to check the test
results. The TEST RESULTS window appears. The test should pass.

4. Close the TEST RESULTS window.

Part 7: Modify and Run the Test


1. In KEYWORD VIEW, select the EDIT step.

2. Change the value in the VALUE column from 3 to 7.

3. Save the test as LABCH6_7.

4. Run the test. It should fail.

5. View the test results. The test failed. In the next lab you will correct the
problem.

Part 8: Add a Regular Expression to Fix the Test


1. On the QuickTest Professional toolbar, select RESOURCES > OBJECT
REPOSITORY. The OBJECT REPOSITORY dialog box appears.

2. In the OBJECT REPOSITORY tree, select the FAX ORDER NO. 3 object.
3. In the OBJECT PROPERTIES pane, in the VALUE column, click to display
the CONFIGURE THE VALUE button.

4. Click the CONFIGURE THE VALUE button. The VALUE CONFIGURATION


OPTIONS dialog box appears.

5. Ensure that the CONSTANT option is selected.

6. In the CONSTANT field, type .*.

7. Check the REGULAR EXPRESSION check box. A dialog box appears.

8. In the dialog box, click NO.

9. Click OK.

10. Close the OBJECT REPOSITORY dialog box.

11. Save the test as LABCH6_8.

12. Run the test.

13. View the test results. The test should pass.

14. Close the Test Results window.


Exercise: Adding Parameters
This exercise requires you to add a checkpoint, a synchronization point, and
regular expressions to a recorded test. In addition, you use input parameters,
output parameters, and regular expressions to modify the parameters, and a
random number parameter to enhance your tests. The activities in this exercise
are divided into the following parts:

Part 1: Record a new order, add a synchronization point, and a checkpoint.

Part 2: Create an output parameter from ACTIVE SCREEN.

Part 3: Parameterize to accept input values.

Part 4: Run the test.

Part 5: Use a random number parameter.

Part 1: Record a New Order, Add a Synchronization Point,


and a Checkpoint
1. Ensure that QuickTest Professional is running and no add-ins are
selected.

2. Ensure that Flight Reservation application is running and you are logged
on.

3. From the QuickTest Professional menu bar, select FILE > NEW >
TEST.

4. On the QuickTest Professional toolbar, click the RECORD button.

5. In the RECORD AND RUN SETTINGS dialog box, click OK.

6. Click the FLIGHT RESERVATION window to activate it.

7. In the FLIGHT RESERVATION window, click the NEW ORDER button to


set initial conditions.

8. Specify the following flight data:

DATE OF FLIGHT: 12-12-09

FLY FROM: Frankfurt

FLY TO: London


9. Click the FLIGHTS button. The FLIGHTS TABLE window appears.

10. In the FLIGHTS TABLE window, click OK.

11. Specify the following transaction data:

NAME: Jane Jenkins

TICKETS: 2

CLASS: First

12. Click INSERT ORDER.

13. Wait for the progress bar to complete and the words INSERT DONE... to
appear.

14. Insert a synchronization point on the INSERT ORDER... step. To do this:

15. From the QuickTest Professional menu bar, select INSERT >
SYNCHRONIZATION POINT after the progress bar completes. The cursor
changes to a pointed finger.

16. In the FLIGHT RESERVATION window, in the progress bar, click the
words INSERT DONE... with the pointed finger cursor. The OBJECT
SELECTION - SYNCHRONIZATION POINT dialog box appears.

17. In the OBJECT SELECTION - SYNCHRONIZATION POINT dialog box, click


OK. The ADD SYNCHRONIZATION POINT dialog box appears.

18. From the PROPERTY NAME list, select TEXT.

19. In the PROPERTY VALUE field, type "INSERT DONE...".

20. Retain the default timeout of 10000 milliseconds.

21. Click OK. An INSERT DONE (Wait Property) step is added in KEYWORD
VIEW.

22. Add a standard checkpoint that uses a regular expression on the FAX
ORDER NO. window title bar. To do this:

23. From the Flight Reservation menu bar, select FILE > FAX ORDER. The
FAX ORDER NO. window appears.

24. From the QuickTest Professional menu bar, select INSERT >
CHECKPOINT > STANDARD CHECKPOINT. The cursor changes to a
pointing hand.
25. Click the FAX ORDER NO. window title bar with the pointing hand
cursor. The OBJECT SELECTION - CHECKPOINT PROPERTIES dialog box
appears.

26. In the OBJECT SELECTION - CHECKPOINT PROPERTIES dialog box, click


OK. The CHECKPOINT PROPERTIES dialog box appears.

27. In the CHECKPOINT PROPERTIES dialog box, check the TEXT check box.
Uncheck all other check boxes.

28. Select the TEXT property and ensure that the CONSTANT option is
selected.

29. Click the CONSTANT VALUE OPTIONS button next to the CONSTANT
field. The CONSTANT VALUE OPTIONS dialog box appears.

30. In the VALUE field, replace the existing text with FAX ORDER NO..*.

31. Check the REGULAR EXPRESSION check box.

32. In the dialog box that appears, click NO.

33. Click OK.

34. In the CHECKPOINT PROPERTIES dialog box, click OK.

35. In the FAX ORDER NO. window, in the FAX NUMBER field, type
4255550150 and click SEND.

36. In the FLIGHT RESERVATION window, click the NEW ORDER button to
set the end condition.

37. On the QuickTest Professional toolbar, click STOP.

38. Modify the object properties for the FAX ORDER NO. title bar step to use
the regular expression. To do this:

39. From the QuickTest Professional menu bar, select RESOURCES >
OBJECT REPOSITORY. The OBJECT REPOSITORY dialog box appears.

40. In the OBJECT REPOSITORY dialog box, select the FAX ORDER NO. object.

41. In the OBJECT PROPERTIES pane, select the TEXT property row.

42. Click the VALUE column. The CONFIGURE THE VALUE button appears.

43. Click the CONFIGURE THE VALUE button. The VALUE CONFIGURATION
OPTIONS dialog box appears.
44. Ensure that the CONSTANT option is selected.

45. In the CONSTANT field, replace the existing text with FAX ORDER NO..*.

46. Check the REGULAR EXPRESSION check box.

47. In the dialog box that appears, click NO.

48. In the VALUE CONFIGURATION OPTIONS dialog box, click OK.

49. Close the OBJECT REPOSITORY dialog box.

50. Save the test as LABCH7_1.

51. Run the test.

52. On the QuickTest Professional toolbar, click the RESULTS button to


view the test results. The test should pass.

Part 2: Create an Output Parameter from Active Screen


1. In KEYWORD VIEW, select the step INSERT DONE.

2. From ACTIVE SCREEN, right-click the ORDER NO. field and select
INSERT OUTPUT VALUE.

3. IN THE OBJECT SELECTION - OUTPUT VALUE PROPERTIES dialog box,


click OK. The OUTPUT VALUE PROPERTIES dialog box appears.

4. Check the TEXT check box.

5. Select the AFTER CURRENT STEP option.

6. Click OK.

7. Ensure that a column called ORDER_NO_TEXT_OUT appears in DATA


TABLE.

8. Save the test as LABCH7_2.

Part 3: Parameterize to Accept Input Values


1. In KEYWORD VIEW, under the first occurrence of FLIGHT RESERVATION,
select the NAME step.

2. Click the VALUE column and then click the CONFIGURE THE VALUE
button. The VALUE CONFIGURATION OPTIONS dialog box appears.

3. Select the PARAMETER option.


4. In the NAME field, replace the existing value with NAME.

5. Ensure that the GLOBAL SHEET option is selected.

6. Click OK.

7. In the QUICKTEST PROFESSIONAL window, in DATA TABLE, in the NAME


column, type SAM, LAURENCE, and CATHERINE in three rows.

8. Save the test as LABCH7_3.

Part 4: Run the Test


1. On the QuickTest Professional toolbar, click RUN.

2. In the RUN dialog box, click OK on the default choice. The test passes.

3. View the test results.

Part 5: Use a Random Number Parameter


1. Ensure that the test LABCH7_3 is open.

2. In KEYWORD VIEW, select the TICKETS step.

3. Select the TICKETS step where operation is SET. This is the second
TICKETS step.

4. In the VALUE column, click to display the CONFIGURE THE VALUE


button.

5. Click the CONFIGURE THE VALUE button. The VALUE CONFIGURATION


OPTIONS dialog box appears.

6. In the VALUE CONFIGURATION OPTIONS dialog box, change the


parameter type from DATATABLE to RANDOM NUMBER.

7. CHANGE THE NUMERIC RANGE from 0 to 100 to 1 to 10.

8. Check the NAME check box and in the NAME field, type TICKETS_OUT.

9. Ensure that the FOR EACH ACTION ITERATION option is selected.

10. CLICK OK.

11. Save the test as LABCH7_4.

12. Run the test.


13. On the QuickTest Professional toolbar, click the RESULTS button. The
TEST RESULTS window appears. The output is displayed in RUN-TIME
DATA TABLE in the ORDER_NO_TEXT_OUT column of the TEST RESULTS
window.

14. Close the QuickTest Professional and Flight Reservation applications.


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


1. Ensure that the QuickTest Professional application is open.

2. Open the LOGIN window of the Flight Reservation application. (Do not
log in yet)

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

1. Click OK. The FLIGHT RESERVATION window appears.

2. On the QuickTest Professional toolbar, click STOP to stop the test.

3. Save the test as LABCH8_1_FLIGHTLOGIN.

4. Close the FLIGHT RESERVATION window.

5. Select START > PROGRAMS > QUICKTEST PROFESSIONAL > SAMPLE


APPLICATIONS > FLIGHT. The LOGIN dialog box appears.
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.


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.

3. This name is an abbreviation for Flight Business process and this action
is not reusable.

4. In the QUICKTEST PROFESSIONAL window, select the FLTBUSPROCESS


action.

5. From the QuickTest Professional menu bar, select INSERT > CALL TO
COPY OF ACTION. The SELECT ACTION dialog box appears.

6. In the SELECT ACTION dialog box, browse, and select the


LABCH8_1_FLIGHTLOGIN test.

7. IN THE ACTION list, ensure that FLIGHT_LOGIN is selected.

8. Ensure that the AFTER THE CURRENT STEP option is selected.

9. Click OK. In KEYWORD VIEW, COPY OF FLIGHT_LOGIN appears.

10. In the KEYWORD VIEW, select the FLTBUSPROCESS action.

11. From the QuickTest Professional menu bar, select INSERT > CALL TO
COPY OF ACTION.

12. IN THE SELECT ACTION dialog box, from the FROM TEST list, browse and
select the LABCH8_3_NEWORDER test.

13. In the ACTION list, ensure that FLIGHT_NEWORDER is selected.

14. Ensure that the AFTER THE CURRENT STEP option is selected.

15. In KEYWORD VIEW, COPY OF FLIGHT_NEWORDER appears before the


FLIGHT_LOGIN test.

16. Drag and drop the FLIGHT_LOGIN action before the


FLIGHT_NEWORDER action.

17. Save the test as LABCH8_4_FLTBUSPROCESS.

18. Close the FLIGHT RESERVATION window and then launch the LOGIN
window of the application. Do not log in.
19. Run the test. The test should pass.

20. 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.

5. 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.

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.

6. Verify that all of the objects that you have added appear in the object
repository tree in the SELECT OBJECT FOR STEP dialog box.

7. In the object repository tree, select the LOGIN window object.

8. 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.
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.

10. 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.

4. You must prepare for the case when the LOGIN window is not found.
You can use the ELSE statement to handle this situation.

5. In KEYWORD VIEW, select the IF statement.

6. From the QuickTest Professional menu bar, select INSERT >


CONDITIONAL STATEMENT > ELSE.

7. THE ELSE statement appears at the end of the test. Click the step with the
ELSE statement. The step changes to a list.

8. From the list, select STEP GENERATOR. The STEP GENERATOR dialog
box appears.

9. In the STEP GENERATOR dialog box, from the CATEGORY list, select
FUNCTIONS.

10. From the LIBRARY list, select ALL. The ALL function library appears.

11. From the OPERATION list, select INVOKEAPPLICATION.

12. In the ARGUMENTS section, select the COMMAND row.


13. 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.

14. Click OK.

15. Run the test.

16. It takes a few seconds to view the test run.

17. In KEYWORD VIEW, select the last step.

18. From the QuickTest Professional menu bar, select INSERT > NEW STEP.
A new step is added.

19. From the list, select OBJECT FROM REPOSITORY. The SELECT OBJECT FOR
STEP dialog box appears.

20. In the SELECT OBJECT FOR STEP dialog box, in the object repository tree,
select the LOGIN window object and click OK.

21. In the KEYWORD VIEW, select the LOGIN step.

22. FROM THE QUICKTEST PROFESSIONAL menu bar, select INSERT > NEW
STEP. A new step is added.

23. From the list, select AGENT NAME.

24. In the VALUE column, type LAURENCE.

25. From the QuickTest Professional menu bar, select INSERT > NEW STEP.
A new step is added.

26. From the list, select PASSWORD.

27. In the VALUE column, type MERCURY.

28. FROM THE QUICKTEST PROFESSIONAL menu bar, select INSERT > NEW
STEP. A new step is added.

29. From the list, select OK.

30. Close the LOGIN window.

31. Save the test as LABCH9_5.

32. Run the test.


33. View the test results.

34. Verify that the ELSE statement was executed.

35. Close the QuickTest Professional and Flight Reservation applications.


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:

DATE OF FLIGHT: 12-12-09

FLY FROM: FROM: Frankfurt

FLY TO: TO: London

NAME: NAME: Sam Smith

TICKETS: 2

CLASS: First

3. Save the test as LABCH11_1.

4. Run the test. The test playback should be successful.


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:

1) A TICKETS step appears in KEYWORD VIEW that has the OUTPUT value in
the OPERATION column.

2) 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.


Part 3: Use a Formula in the Data Table
1. In the GLOBAL sheet of DATA TABLE, specify test data for the following
fields:

NTICKETS: 1

PRICE: 123

TOTAL: 123

2. For the first row under the PRICECHK column, type the following
formula:
=ROUND(A1*B1,2)=ROUND(C1,2)

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”.

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.

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.

4. The number of tickets can be 1-10, inclusive of 1 and 10.

5. On the QuickTest Professional toolbar, click RUN. The test continues to


run from the breakpoint step.

6. Open the TEST RESULTS window. The test fails.

7. Expand all steps in the TEST RESULTS window to view the output of the
REPORTER step.

8. Check the values in RUN-TIME DATA TABLE to see which values passed.

9. 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.

2. Do not select any add-ins.

3. On the QuickTest Professional toolbar, click NEW.

4. Open and log on to the Flight Reservation application.

5. Record a new reservation that includes the following flight information


(be sure you are in Record mode)

DATE OF FLIGHT: 12-12-09

FLY FROM: Frankfurt

FLY TO: London

NAME: Sam Smith

TICKETS: 2

CLASS: First

6. Click INSERT ORDER.


7. From the QuickTest Professional menu bar, select INSERT Æ
SYNCHRONIZATION POINT after the progress bar completes. The cursor
changes to a pointed finger.

8. In the FLIGHT RESERVATION window, in the progress bar, click the


words INSERT DONE... with the pointed finger cursor.

9. In the OBJECT SELECTION - SYNCHRONIZATION POINT dialog box, click


OK. The ADD SYNCHRONIZATION POINT dialog box appears.

10. From the PROPERTY NAME list, select TEXT.

11. In the PROPERTY VALUE field, type "INSERT DONE...".

12. In the TIMEOUT field, retain the default value.

13. Click OK.

14. In the FLIGHT RESERVATION window, click the NEW ORDER button to
set end conditions for the test.

15. On the QuickTest Professional toolbar, click STOP to stop the test.

16. Save the test as LABCH12_1.

17. In KEYWORD VIEW, select the INSERT DONE step.

18. 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.

19. Click OK. The OUTPUT VALUE PROPERTIES dialog box appears.

20. Check the TEXT check box, and click MODIFY. The OUTPUT OPTIONS
dialog box appears.

21. In the NAME field, type GUIORDER_NO.

22. Click OK to close the OUTPUT OPTIONS dialog box.

23. In the OUTPUT VALUE PROPERTIES dialog box, select the AFTER
CURRENT STEP option.

24. Click OK to close the OUTPUT VALUE PROPERTIES dialog box.

25. Verify that:

26. The KEYWORD VIEW has an ORDER NO step that has the OUTPUT value
in the OPERATION column.
27. The GLOBAL sheet of DATA TABLE has a column named
GUIORDER_NO.

28. Repeat steps 17 to 24 to create an output parameter for the number of


tickets and name it as NTICKETS.

29. Save the test.

30. 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*.

9. The Flight Reservation AUT uses the QT_FLIGHT32* database.

10. Ensure that the USE THE QUERY WIZARD TO CREATE/EDIT QUERIES check
box is checked.

11. Click OK.

12. 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 the table.

13. 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.

14. In the QUERY WIZARD - FILTER DATA dialog box, click NEXT.

15. In the QUERY WIZARD - SORT ORDER dialog box, from the SORT BY list,
select ORDER_NUMBER.

16. Select the DESCENDING option, and click NEXT.

17. In the QUERY WIZARD - FINISH dialog box, click SAVE QUERY.

18. In the SAVE AS dialog box, click SAVE to save the query by the default
query name. The QUERY WIZARD - FINISH dialog box appears.

19. Ensure that the EXIT AND RETURN TO QUICKTEST PROFESSIONAL option
is selected.

20. 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.
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.

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: 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.

2. Do not select any add-ins.

3. On the QuickTest Professional toolbar, click NEW.

4. Open and log on to the Flight Reservation application.

5. Record a new reservation that includes the following flight information


(be sure you are in Record mode)

DATE OF FLIGHT: 12-12-09

FLY FROM: Frankfurt

FLY TO: London

NAME: Sam Smith

TICKETS: 2

CLASS: First

6. Click INSERT ORDER.


7. From the QuickTest Professional menu bar, select INSERT Æ
SYNCHRONIZATION POINT after the progress bar completes. The cursor
changes to a pointed finger.

8. In the FLIGHT RESERVATION window, in the progress bar, click the


words INSERT DONE... with the pointed finger cursor.

9. In the OBJECT SELECTION - SYNCHRONIZATION POINT dialog box, click


OK. The ADD SYNCHRONIZATION POINT dialog box appears.

10. From the PROPERTY NAME list, select TEXT.

11. In the PROPERTY VALUE field, type "INSERT DONE...".

12. In the TIMEOUT field, retain the default value.

13. Click OK.

14. In the FLIGHT RESERVATION window, click the NEW ORDER button to
set end conditions for the test.

15. On the QuickTest Professional toolbar, click STOP to stop the test.

16. Save the test as LABCH12_1.

17. In KEYWORD VIEW, select the INSERT DONE step.

18. 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.

19. Click OK. The OUTPUT VALUE PROPERTIES dialog box appears.

20. Check the TEXT check box, and click MODIFY. The OUTPUT OPTIONS
dialog box appears.

21. In the NAME field, type GUIORDER_NO.

22. Click OK to close the OUTPUT OPTIONS dialog box.

23. In the OUTPUT VALUE PROPERTIES dialog box, select the AFTER
CURRENT STEP option.

24. Click OK to close the OUTPUT VALUE PROPERTIES dialog box.

25. Verify that:

26. The KEYWORD VIEW has an ORDER NO step that has the OUTPUT value
in the OPERATION column.
27. The GLOBAL sheet of DATA TABLE has a column named
GUIORDER_NO.

28. Repeat steps 17 to 24 to create an output parameter for the number of


tickets and name it as NTICKETS.

29. Save the test.

30. 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*.

9. The Flight Reservation AUT uses the QT_FLIGHT32* database.

10. Ensure that the USE THE QUERY WIZARD TO CREATE/EDIT QUERIES check
box is checked.

11. Click OK.

12. 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 the table.

13. 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.

14. In the QUERY WIZARD - FILTER DATA dialog box, click NEXT.

15. In the QUERY WIZARD - SORT ORDER dialog box, from the SORT BY list,
select ORDER_NUMBER.

16. Select the DESCENDING option, and click NEXT.

17. In the QUERY WIZARD - FINISH dialog box, click SAVE QUERY.

18. In the SAVE AS dialog box, click SAVE to save the query by the default
query name. The QUERY WIZARD - FINISH dialog box appears.

19. Ensure that the EXIT AND RETURN TO QUICKTEST PROFESSIONAL option
is selected.

20. 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.
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.

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: Creating a Recovery Scenario
In this exercise, you will create a test that encounters an error during playback. You
will then create a recovery scenario to correct the problem when the automated test
runs.

Part 1: Create a Basic Test by Addding a Step Without Recording

Part 2: Set a Synchronization Point

Part 3: Set a Parameter

Part 4: Create a Recovery Scenario

Part 5: Change Recovery Scenario Run Settings

Part 1: Add a Step Without Recording


1. Create a Blank Test.

2. From the QuickTest Professional menu bar, select INSERT > NEW STEP>
STEP GENERATOR.

3. The STEP GENERATOR dialog box appears.

4. Insert the following:

a. CATEGORY: Functions

b. LIBRARY: All

c. OPERATION: InvokeApplication

d. ARGUMENTS: COMMAND - Value


C:\Program Files\Mercury Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe".

5. Click OK.

6. Run the test to make sure the step produces the expected result, the
invocation of the Flights application with a Login window.

7. Leave the Login window up on desktop.

8. Save this test as RECOVERY_SCENARIO.

Part 2: Set a Synchronization Point


1. Ensure that the Login window is on desktop.

2. Click on the RECORD button to record the login business process.

3. Accept the recording on “Any open Windows-based application”


selection.

4. Log into the application with:

a. AGENT NAME: 1234

b. PASSWORD: mercury

5. The Flight application is in the process of starting. Because it takes a


while, we will synchronize on the window.

6. While still in Record mode, from the menu bar choose INSERT>
SYNCHRONIZATION POINT

7. Choose the Flights window object to synchronize on.

8. In the Properties dialog, choose Enabled – True for the state of the
window.

9. Continue recording the closing of the main Flight application window as


the final step of the test.

10. Stop recording.

11. Run the test to verify that it functions as expected:

a. Flight application invokes

b. Login window appears and in logged into.

c. Flight application closes.

Part 3: Set a Parameter

1. Parameterize the password entry in the test to run multiple iterations.

2. Click on the "configure the value" button in the password edit box.

3. Define the Data Table as the parameter type in the Global Data Sheet.

4. Create a parameter named "Password”.


5. Replace the original encrypted Set Secure string with a Set operation and
the understandable password "mercury".

6. Create a second row under Password with an incorrect password value


of "merc".

7. Execute the test. You will notice that on the second iteration, the test
encounters a pop up message indicating that an incorrect password has
been entered.

8. Stop the test, but leave the error message on desktop.

Part 4: Create a Recovery Scenario

1. From the menu bar choose RESOURCES> SCENARIO MANAGER

2. Click on the New Scenario button.

3. Click the NEXT button.

4. Define the Trigger Event as a “Pop-up Window”.

5. Click the NEXT button.

6. Use the Pointing Hand to point to the offending pop-up. Note: both the
window title and window text can be defined as a regular expression.

7. Click the NEXT button.

8. Click the NEXT button again.

9. In the Recovery Operation dialog, set the operation as “Keyboard


/Mouse operation.

10. Click the NEXT button.

11. Choose the option “Button with specified label”.

12. Click on pointing hand, then click on the OK button in the error message
dialog.

13. Define another Recovery Operation to kill the Flight4a application


process.

14. Choose “Close application process”.

15. Choose the flight4a.exe process from the list on left.


16. Click the ADD button to move the process from left to right.

17. Click the NEXT button.

18. You are now back in the Recovery Operations window and the two
operations should be listed.

19. Uncheck the “Add another” box.

20. Click the NEXT button.

21. You are in the Post-Recovery Test Run options window.

22. Choose “Proceed to next test iteration”.

23. Save the test as “Incorrect Password Error”

24. Click FINISH.

25. Click CLOSE.

26. Add this recovery scenario to the current test.

27. Run the test to ensure that it works as expected. You will notice that the
test “hangs”.

Part 5: Change Recovery Scenario Run Settings

1. Go to the menu bar and select FILE > TEST SETTINGS.

2. Click on the RECOVERY tab.

3. Change the Run settings to “Run on every step”.

4. Re-run the test.

5. View Test Results for information about the recovery scenario usage.

Das könnte Ihnen auch gefallen