Exercise QTP

Embed Size (px)

Citation preview

  • 7/27/2019 Exercise QTP

    1/10

    Exercise: Preparing the TestEnvironmentUse the Windows-based Flight Reservation application to prepare forrecording. Before

    creating a test, set up the test environment and get familiar with theapplication undertest. Use the best practices to prepare for and implement yourautomated test. Thisexercise is divided into following parts.Part 1: Launch QuickTest Professional 9.0.Part 2: Set QuickTest test options.

    Part 1: Launch QuickTest Professional 9.01. Click START PROGRAMS QUICKTEST PROFESSIONAL QUICKTESTPROFESSIONAL.2. Ensure all options are unchecked in the ADD-IN MANAGER dialog box.3. Click OK.4. In the QUICKTEST PROFESSIONAL window, click BLANKTEST.

    Part 2: Set QuickTest Test Options1. From the QuickTest Professional menu bar, select TOOLS OPTIONS.2. In the GENERAL tab, click RESTORE LAYOUT to ensure that the layout isuniformand all panes and toolbars are displayed in their default positions andsizes.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 isunchecked.6. Ensure that the ALLOW OTHER MERCURY PRODUCTS TO RUNTESTS ANDCOMPONENTS check box is unchecked.7. From the SAVE STEP SCREEN CAPTURE TO RESULTS list, select ON ERRORSAND

    WARNINGS.8. Click OK.Instructor NotesBefore the students begin the exercise, ensure that the QuickTest Professional 9.0 and Flight Reservationapplication are installedon every computer. The students must understand the Flight Reservation application that they are goingto use for recording the

    test.Exercise: Preparing the Test Environment 2-28Preparing to Record

    9. Close the QuickTest Professional application.

  • 7/27/2019 Exercise QTP

    2/10

    Exercise: Creating a Basic TestThis 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 Conditions1. 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: mercury3. 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 ANDRUNSETTINGS dialog box appears.

    The RECORD AND RUN SETTINGS dialog box appears when you click RECORD button in a newtest.

    Note: Start and end recording from the FLIGHT RESERVATION window toset the window

    as the initial and end condition for the test.6. Select the RECORD AND RUN TEST ON ANY OPEN WINDOWS-BASEDAPPLICATION

    option.Instructor Notes

    Before the students begin the exercise, ensure that a directory tree has been set up under \QTP9.0\TESTS in the local driveof every computer where students can save their tests.

    Creating a Basic Test

  • 7/27/2019 Exercise QTP

    3/10

    Exercise: Creating a Basic Test 3-157. Click OK. Ensure a blinking RECORDING message appears in the lowerright of theQUICKTEST PROFESSIONAL window.Notice that the QUICKTEST PROFESSIONAL window has resized for

    recording.Note:You can move and resize the QUICKTEST PROFESSIONAL window.Thismovement does not impact the recording. Position the QUICKTESTPROFESSIONALwindow and the FLIGHT RESERVATION window so that you can see both.

    Part 2: Record the Business Process1. Click the FLIGHT RESERVATION window to activate it.2. On the FLIGHT RESERVATION toolbar, click the NEW ORDER icon to setthe initialcondition. Notice that a step is added in the KEYWORD VIEW.

    3. Specify the following flight data: DATE: 11-11-09 FLY FROM: DENVER FLYTO: SEATTLE4. Click FLIGHTS. The FLIGHTSTABLE appears.5. On the default choice, click OK.6. Specify the following:

    NAME: SAM SMITHTICKETS: 2 CLASS: FIRST

    7. Click INSERT ORDER. Wait for the progress bar to complete. When theinsertion iscomplete, the INSERT DONE... message appears.8. On the FLIGHT RESERVATION toolbar, click the NEW ORDER icon to setthe endcondition.9. On the QuickTest Professional toolbar, click STOP to stop the test.Exercise: Creating a Basic Test 3-16Creating a Basic Test

    Part 3: Save the Test1. In the QUICKTEST PROFESSIONAL window, select FILE SAVE. The SAVE

    TESTdialog box appears.2. Browse to the directory \QTP90USING\TESTS.3. In the FILE NAME field, type LABCH3_3.4. Click SAVE.Note: For training purposes, a directory tree was set up on one of yourlocal drives under\QTP90USING\TESTS. Save all your tests in this directory.

  • 7/27/2019 Exercise QTP

    4/10

    Part 4: Run the Test1. On the toolbar, click RUN.2. Click OKto 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 theRESULTS button.2. From the tree on the left side of TEST RESULTS window, right-click theTEST SUMMARYnode and select EXPAND ALL.3. View the results.4. Close the TEST RESULTS window and QuickTest Professional.

    Exercise: Using Object RepositoryThis exercise enables you to record a new test and use the variousfeatures of the OBJECTREPOSITORY dialog box. The activities in this exercise are divided into thefollowingparts: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 OrderNote: Ensure that the QuickTest Professional and Flight Reservationapplications areopen on your computer.

  • 7/27/2019 Exercise QTP

    5/10

    1. In the QuickTest Professional menu bar, select FILE 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 toolbar, click NEW ORDER button toset

    the initial condition.5. Enter the following flight data:

    DATE OF FLIGHT: 12-12-09 FLY FROM: FrankfurtInstructor NotesBefore students start this exercise, ensure that students know the concept of objects and classes and canidentify different objects

    on the FLIGHT RESERVATION window.Working with Objects

    Exercise: Using Object Repository 4-25

    FLYTO: London6. Click FLIGHTS. The FLIGHTSTABLE appears.

    7. Click OKto accept the default choice.8. Enter the following purchase data:

    NAME: MauraTICKETS: 2 CLASS: First9. Click INSERT ORDER.10. On the FLIGHT RESERVATION window toolbar, click NEW ORDER to setendconditions.11. On the QuickTest Professional toolbar, click STOP to end the

    recording session.12. Save the test as LABCH4_1.

    Part 2: Open the Object Repository Dialog Box1. From the QuickTest Professional menu bar, select RESOURCES OBJECTREPOSITORY.2. How many objects can you identify in the Object Repository?11 or 12 if the OK button is counted.__________________________________

    FLIGHT RESERVATION, FIRST, DATE OF FLIGHT,TICKETS, NAME, FLYTO, FLYFROM, INSERT ORDER, FLIGHT, BUTTON, FLIGHTSTABLE, and OK.3. How many different classes of objects can you identify?

    Seven._________________________________________________________FLIGHT RESERVATION, FIRST, DATE OF FLIGHT, (TICKETS and NAME), (FLYTO andFLY FROM), (INSERT ORDER, FLIGHT, and BUTTON), and FLIGHTSTABLE.4. How many objects of the class WinButton are shown?Three or four if the OK button is counted._____________________________

    INSERT ORDER, FLIGHT, and BUTTON.5. After you are done, close the OBJECT REPOSITORY dialog box.

  • 7/27/2019 Exercise QTP

    6/10

    Review the last set of questions as a group.

    Exercise: Using Object Repository 4-26Working with Objects

    Part 3: Change the Logical Name of an Object1. From the QuickTest Professional menu bar, select RESOURCES

    OBJECTREPOSITORY. 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 Feature1. Ensure that the FLIGHT RESERVATION window is open.2. On the QuickTest Professional toolbar, click the OBJECT SPYbutton.

    TheOBJECT SPY dialog box appears.3. In the OBJECT SPY dialog box, click the pointing finger button. Themousecursor changes to a pointing finger.4. In the FLIGHT RESERVATION window, click the NAME field with thepointed fingercursor. The OBJECT SPY dialog box shows the object properties for theNAME field.5. Document the following object property values:a) CLASS NAME______________________

    WINEDITb) ENABLED______________________TRUEc) ATTACHED TEXT_____________________NAME:d) NATIVECLASS______________________EDITWorking with Objects

    Exercise: Using Object Repository 4-276. Close the OBJECT SPY dialog box.

    Part 5: Use the Highlight Feature1. Ensure that the LABCH4_3 test and the FLIGHT RESERVATION window areopen.2. From the QuickTest Professional menu bar, select RESOURCES OBJECTREPOSITORY. The OBJECT REPOSITORY dialog box appears.3. In the OBJECT REPOSITORY tree, select the NEW ORDER object.4. Click the HIGHLIGHT IN APPLICATION button.

  • 7/27/2019 Exercise QTP

    7/10

    5. Observe the FLIGHTS RESERVATION window.6. What did you observe?A temporary frame blinks around the NEW ORDER icon in the FLIGHTRESERVATION window.___________________________________________________________________________________________________________

    Part 6: Use the Locate in Repository Feature1. On the OBJECT REPOSITORY toolbar, click the LOCATE IN REPOSITORYbutton.The cursor changes to a pointing hand.2. In the FLIGHTS RESERVATION window, use the pointing hand cursor topoint to theNEW ORDER button and click the NEW ORDER button. The SELECT AN OBJECTdialog box appears.3. Click OK.4. What did you observe?The NEW ORDER object is highlighted in the OBJECT REPOSITORY dialog box.

    _Part 7: Add a New Object5. In the OBJECT REPOSITORYtree, select the FLIGHT object.6. On the Object Repository toolbar, click the DEFINE NEW TEST OBJECTbutton.The DEFINE NEWTEST OBJECT dialog box appears.Note: Alternatively, select OBJECT DEFINE NEW TEST OBJECT.7. From the ENVIRONMENT list, select STANDARD WINDOWS.

    8. From the CLASS list, select WINBUTTON.9. In the NAME field, type OK.

    10. In the TEST OBJECT DETAILS section, click the VALUE column for theTEXT

    property, and type OK.11. Click ADD to add the new test object to the local object repository.12. Click CLOSE to close the DEFINE NEWTEST OBJECT dialog box. A newobject isadded under the FLIGHT object.13. Close the OBJECT REPOSITORY dialog box.14. Save the test as LABCH4_7.15. Close the QuickTest Professional and Flight Reservationapplications.

  • 7/27/2019 Exercise QTP

    8/10

    Exercise: Adding SynchronizationYou need to cause a test to fail by changing the default timeoutsetting. View the errorthat occurs because of this change, and correct it to ensure asuccessful test run. Thisexercise enables you to add synchronization to your tests. Thisexercise is divided intothe 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 aTest1. Invoke the QuickTest Professional and Flight Reservationapplications.2. From the QuickTest Professional menu bar, select FILE NEW TEST to open anew 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 synchronizationtimefrom 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 setinitialconditions for the test.

    10. Type the following flight data: DATE OF FLIGHT: 12-12-09 FLY FROM: FRANKFURT FLYTO: LONDONInstructor NotesBefore students start this exercise, ensure that they understand why synchronization is used in a test.

    Using Synchronization

    Exercise: Adding Synchronization 5-11

  • 7/27/2019 Exercise QTP

    9/10

    11. Click FLIGHTS. The FLIGHTSTABLE appears.12. Click OKto accept the default choice.13. Type the following purchase data:

    NAME: MAURATICKETS: 2

    CLASS: FIRST14. Click INSERT ORDER.15. Wait until the INSERT DONE... message appears.16. On the Flight Reservation toolbar, click NEW ORDER to set endconditions.17. On the QuickTest Professional toolbar, click STOP to stop recording.18. Save the test as LABCH5_1.

    Part 2: Run the Modified Test1. On the QuickTest Professional toolbar, click RUN.2. In the RUN dialog box, ensure that the TEMPORARY RUN RESULTS FOLDERoption isselected.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 messagebox.

    OBJECT IS DISABLED

    Part 3: Correct the Error by Inserting aSynchronization Point1. 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 themenu bar, selectINSERT SYNCHRONIZATION POINT. The cursor changes to a pointedfinger.5. In the progress bar, click the words INSERT DONE... with the pointedfinger cursor.The OBJECT SELECTION - SYNCHRONIZATION POINT dialog box appears.Exercise: Adding Synchronization 5-12Using Synchronization

    6. In the OBJECT SELECTION - SYNCHRONIZATION POINT dialog box, click OK.TheADD 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.

  • 7/27/2019 Exercise QTP

    10/10

    12. Save the test.13. On the QuickTest Professional toolbar, click RUN to run the test.The RUN dialogbox appears.14. Click OKto close the RUN dialog box. The test should succeed.

    15. On the QuickTest Professional toolbar, click the RESULTS icon toview the testresults. The TEST RESULTS window appears.16. View the test results and close the TEST RESULTS window.17. Close the test.