Qtp day 2

31
QTP QTP

Transcript of Qtp day 2

Page 1: Qtp day 2

QTPQTP

Page 2: Qtp day 2

Day2: QTP FeaturesDay2: QTP Features

Synchronization pointsSynchronization points

Modes of RecordingModes of Recording

CheckpointsCheckpoints

Page 3: Qtp day 2

Synchronization pointsSynchronization pointsSynchronization in QTPSynchronization in QTPWhen you run a test, your application may not When you run a test, your application may not always respond with the same speed. For always respond with the same speed. For example, it may take a few secondsexample, it may take a few seconds· For the progress bar to reach 100 %· For the progress bar to reach 100 %· For the status message to appear· For the status message to appear· For a button to become enabled· For a button to become enabledYou can handle these anticipated timing You can handle these anticipated timing problems by synchronizing your test to ensure problems by synchronizing your test to ensure that QuickTest waits until your application is that QuickTest waits until your application is ready before performing a certain step.ready before performing a certain step.

Page 4: Qtp day 2

Synchronization pointsSynchronization pointsThere are several options for synchronization in There are several options for synchronization in QTP:QTP:Synchronization Point: are inserted while Synchronization Point: are inserted while recording a script using the following pathrecording a script using the following pathInsert > Synchronization pointInsert > Synchronization pointInserting a synchronization point instructs QTP to Inserting a synchronization point instructs QTP to pause the test until an object property achieves the pause the test until an object property achieves the value you specify. Inserting a synchronization value you specify. Inserting a synchronization point basically inserts a WaitProperty statement in point basically inserts a WaitProperty statement in codecodeQTPObject.WaitProerty “Property Name”, QTPObject.WaitProerty “Property Name”, ”Expected Value”, Time to wait in milliseconds”Expected Value”, Time to wait in milliseconds

Page 5: Qtp day 2

Synchronization pointsSynchronization points

Exist or Wait statement: instructs QTP to Exist or Wait statement: instructs QTP to wait until an object exists or to wait for a wait until an object exists or to wait for a specified time before continuing the test.specified time before continuing the test.While the wait statement forces QTP to While the wait statement forces QTP to wait for the specified time, the Exist wait for the specified time, the Exist checks for the existence of an object and checks for the existence of an object and returns a Boolean value. returns a Boolean value.

Page 6: Qtp day 2

Synchronization pointsSynchronization pointsFor exampleFor exampleblnDone = Window(“..”).Dialog(“..”).ExistblnDone = Window(“..”).Dialog(“..”).Existcounter = 1counter = 1while not blnDonewhile not blnDone wait(2)wait(2) blnDone = Window(“..”).Dialog(“..”).ExistblnDone = Window(“..”).Dialog(“..”).Exist counter = counter + 1counter = counter + 1 if counter = 10 thenif counter = 10 then blnDone = TrueblnDone = True End IfEnd IfWendWend

Page 7: Qtp day 2

Synchronization pointsSynchronization points

Timeout Value Modification: If you find Timeout Value Modification: If you find that, in general, the amount of time that, in general, the amount of time QuickTest waits for objects to appear or for QuickTest waits for objects to appear or for an object to navigate to a specified page is an object to navigate to a specified page is not sufficient, you can increase the default not sufficient, you can increase the default object synchronization timeout values for object synchronization timeout values for your test and the browser navigation your test and the browser navigation timeout values for your test.timeout values for your test.

Page 8: Qtp day 2

Synchronization pointsSynchronization points

When working with tests, to modify the When working with tests, to modify the maximum amount of time that QTP waits for maximum amount of time that QTP waits for an object to appear, change the object an object to appear, change the object synchronization timeout in File -> Settings -> synchronization timeout in File -> Settings -> Run paneRun paneTo modify the amount of time that QTP waits To modify the amount of time that QTP waits for a web page to laod, change the browser for a web page to laod, change the browser navigation timeout in the File -> Settings -> navigation timeout in the File -> Settings -> Web Pane.Web Pane.

Page 9: Qtp day 2

Synchronization pointsSynchronization points

Specific time: Uses the wait function Specific time: Uses the wait function to pause the test for a specific amount to pause the test for a specific amount of time [in seconds].of time [in seconds].Until an event occurs: Pauses until a Until an event occurs: Pauses until a specific property of an object has a specific property of an object has a specific value.specific value.

Page 10: Qtp day 2

Modes of RecordingModes of Recording

QTP supports 3 types of recording QTP supports 3 types of recording modesmodes

  1) Context Sensitive1) Context Sensitive

2)Analog2)Analog

3) Low Level3) Low Level

Page 11: Qtp day 2

Modes of RecordingModes of RecordingQTP supports three types of recording modes. QTP supports three types of recording modes. They are:They are:1) Normal recording mode1) Normal recording mode2) Analog Recording2) Analog Recording3) Low Level Recording3) Low Level Recording1) Normal recording mode records the objects in 1) Normal recording mode records the objects in your application and the operations performed your application and the operations performed on them. This mode is the default and takes full on them. This mode is the default and takes full advantage of the QuickTest test object model, advantage of the QuickTest test object model, recognizing the objects in your application recognizing the objects in your application regardless of their location on the screen.regardless of their location on the screen.

Page 12: Qtp day 2

Modes of RecordingModes of RecordingContext Sensitive Recording modeContext Sensitive Recording mode

Normal recording modeNormal recording mode is also called Context  is also called Context Sensitive ModeSensitive Mode

It is the It is the default modedefault mode of recording which takes full  of recording which takes full advantage of Quick Test Professional's  test object advantage of Quick Test Professional's  test object model.model.

It It recognizes objectsrecognizes objects in application  in application regardless of regardless of their locationtheir location on the screen. on the screen.

It recordsIt records the  the objectsobjects in your  in your application application andand the  the operations performed on them.operations performed on them.

Page 13: Qtp day 2

Modes of RecordingModes of RecordingHP Quick Test Pro offers three recording modes with HP Quick Test Pro offers three recording modes with Normal as default. The basics of the recording modes Normal as default. The basics of the recording modes are describe as follows:are describe as follows:Normal Recording:Normal Recording:Default recording mode.Default recording mode.Learns a GUI object properties, and stores them in Learns a GUI object properties, and stores them in the object repository.the object repository.Does not depend on window coordinates, desktop Does not depend on window coordinates, desktop coordinates, or screen resulation for successful coordinates, or screen resulation for successful playback.playback.Records only a step for each action or operation on Records only a step for each action or operation on an object.an object.

Page 14: Qtp day 2

Modes of RecordingModes of Recording

Analog Recording ModeAnalog Recording Mode  In analog recording mode, Quick Test In analog recording mode, Quick Test Professional  Professional  records and tracks every records and tracks every movementmovement  of the mouseof the mouse as you drag the mouse  as you drag the mouse around a screen or window.around a screen or window.QTP’s Analog recording is QTP’s Analog recording is captured as  captured as  TracksTracks and stored in the directory of your test and stored in the directory of your testIt is useful  for recording operations that cannot be It is useful  for recording operations that cannot be recorded at the level of an object. Ex., A signature recorded at the level of an object. Ex., A signature produced by dragging the mouse.produced by dragging the mouse.

Page 15: Qtp day 2

Modes of RecordingModes of Recording

2) Analog Recording. Enables you to 2) Analog Recording. Enables you to record the exact mouse and keyboard record the exact mouse and keyboard operations you perform in relation to operations you perform in relation to either the screen or the application either the screen or the application window. In this recording mode, window. In this recording mode, QuickTest records and tracks every QuickTest records and tracks every movement of the mouse as you drag the movement of the mouse as you drag the mouse around a screen or window.mouse around a screen or window.

Page 16: Qtp day 2

Modes of RecordingModes of Recording

In Analog mode you can record In Analog mode you can record 1) Record 1) Record Relative to screen & 2) Relative to windowRelative to screen & 2) Relative to windowWhen your analog operation are confined to When your analog operation are confined to just one window , use relative to windowjust one window , use relative to windowWhen your analog operation involve multiple When your analog operation involve multiple screens like dragging and dropping an object screens like dragging and dropping an object from one window to other use the screen from one window to other use the screen option.option.

Page 17: Qtp day 2

Modes of RecordingModes of Recording

Analog Recording:Analog Recording:Requires more disk space than a Normal recording.Requires more disk space than a Normal recording.Record exact mouse movements, mouse clicks and Record exact mouse movements, mouse clicks and keyboard operations relative to the X-Y coordinate keyboard operations relative to the X-Y coordinate location on the desktop or application window.location on the desktop or application window.Records only one step for the duration of the analog Records only one step for the duration of the analog recording session. This step shows up in the recording session. This step shows up in the Keyword View as a Keyword View as a RunAnalogRunAnalog operation. operation.Creates a binary file, AnalogTrackList.dat to store Creates a binary file, AnalogTrackList.dat to store the analog actions and places it in the action folder. the analog actions and places it in the action folder. No object information is stored in the object No object information is stored in the object repository.repository.

Page 18: Qtp day 2

Modes of RecordingModes of Recording

3) Low Level Recording. Enables you to 3) Low Level Recording. Enables you to record on any object in your application, record on any object in your application, whether or not QuickTest recognizes the whether or not QuickTest recognizes the specific object or the specific operation. This specific object or the specific operation. This mode records at the object level and records all mode records at the object level and records all run-time objects as Window or WinObject test run-time objects as Window or WinObject test objects. Use low-level recording for recording objects. Use low-level recording for recording in an environment or on an object not in an environment or on an object not recognized by QuickTest. You can also use recognized by QuickTest. You can also use low-level recording if the exact coordinates of low-level recording if the exact coordinates of the object are important for your test.the object are important for your test.

Page 19: Qtp day 2

Modes of RecordingModes of Recording

Low-level Recording:Low-level Recording:Learns the object into the Window class or the Learns the object into the Window class or the WinObject class along with their attributes WinObject class along with their attributes and stores this information in the object and stores this information in the object repository.repository.Records only mouse clicks, drag and drop, and Records only mouse clicks, drag and drop, and type operations on an object.type operations on an object.Records only a step for each action or Records only a step for each action or operation on an object.operation on an object.

Page 20: Qtp day 2

Modes of RecordingModes of Recording

Low Level ModeLow Level ModeThis mode enables you to This mode enables you to record on any record on any objectobject in your application in your application, irrespective of , irrespective of  QTP recognizes the specific object or the  QTP recognizes the specific object or the specific operation.specific operation.This mode records at the object level and This mode records at the object level and records all run-time objects as either records all run-time objects as either Window Window or WinObjector WinObject test objects.. test objects..It is It is used when the exact coordinates of the used when the exact coordinates of the object are important for your testsobject are important for your tests. . 

Page 21: Qtp day 2

Modes of RecordingModes of Recording

A good example would be hashmaps where A good example would be hashmaps where clicking different sections of a picture takes clicking different sections of a picture takes you to different linksyou to different links

Used when recording tests in an Used when recording tests in an environment (or on an object) not environment (or on an object) not recognized by QTPrecognized by QTP

Low level mode records the x,y coordinates Low level mode records the x,y coordinates of any clicks.of any clicks.

Page 22: Qtp day 2

Modes of RecordingModes of Recording

SummarySummary

Analog recording and low-level recording Analog recording and low-level recording require more disk space than normal require more disk space than normal recording mode.recording mode.

For both modes , screen positions during the For both modes , screen positions during the record and run time needs to be identical record and run time needs to be identical otherwise script fails.otherwise script fails.

Page 23: Qtp day 2

Modes of RecordingModes of Recording

SummarySummary

Hence, Use analog recording or low-level Hence, Use analog recording or low-level recording only when normal recording mode recording only when normal recording mode does not accurately record your operation.does not accurately record your operation.

At times QTP automatically switches to low At times QTP automatically switches to low level mode while recording objects or level mode while recording objects or environments not supported by QTP.environments not supported by QTP.

Page 24: Qtp day 2

CheckpointsCheckpoints

Meaning of Checkpoints: Meaning of Checkpoints: A A mechanism to check the property of mechanism to check the property of an object.an object.A checkpoint verifies that expected A checkpoint verifies that expected information is displayed in an information is displayed in an Application while the test is running.Application while the test is running.

Page 25: Qtp day 2

CheckpointsCheckpoints

Types of checkpoints:Types of checkpoints:You can add eight types of checkpoints to your You can add eight types of checkpoints to your test for standard web objects using QTP.test for standard web objects using QTP.A page checkpoint A page checkpoint checks the characteristics checks the characteristics of an Application.of an Application.A text checkpoint A text checkpoint checks that a text string is checks that a text string is displayed in the appropriate place on an displayed in the appropriate place on an Application.Application.An object checkpoint (Standard) An object checkpoint (Standard) checks the checks the values of an object on an Application.values of an object on an Application.

Page 26: Qtp day 2

CheckpointsCheckpointsAn image checkpoint An image checkpoint checks the values of an checks the values of an image on an Application.image on an Application.A table checkpoint A table checkpoint checks information within a checks information within a table on a Application.table on a Application.An Accessibilityy checkpoint An Accessibilityy checkpoint checks the web checks the web page for Section 508 compliance.page for Section 508 compliance.An XML checkpoint An XML checkpoint checks the contents of checks the contents of individual XML data files or XML documents individual XML data files or XML documents that are part of your Web application.that are part of your Web application.A database checkpoint A database checkpoint checks the contents of checks the contents of databases accessed by your web site.databases accessed by your web site.

Page 27: Qtp day 2

CheckpointsCheckpointsTo add checkpoints:To add checkpoints:We can add checkpoints while recording the We can add checkpoints while recording the application or we can add after recording is application or we can add after recording is completed using Active screen (Note : To completed using Active screen (Note : To perform the second one The Active screen must perform the second one The Active screen must be enabled while recording).be enabled while recording).Ways to set checkpoints:Ways to set checkpoints:In the recording mode. In the recording mode. In the insert mode in keyword view screen (right In the insert mode in keyword view screen (right mouse click). mouse click). In an active screen modeIn an active screen mode

Page 28: Qtp day 2

CheckpointsCheckpoints

To determine a checkpoint:To determine a checkpoint:A checkmark appears next to the step in the A checkmark appears next to the step in the results. The OPERATION column of results. The OPERATION column of KEYWORD VIEW lists the operation as KEYWORD VIEW lists the operation as CHECK.CHECK.To make checkpoint flexible: To make checkpoint flexible: A check mark appears at each level of the Test A check mark appears at each level of the Test Summary tree.Summary tree.Create and insert a regular expression or input Create and insert a regular expression or input data to the parameter using the design-time Data data to the parameter using the design-time Data TableTable

Page 29: Qtp day 2

QTP ContinuedQTP Continued

Day3: Day3:

Advanced FeaturesAdvanced Features

ParameterizationParameterization

Step GeneratorStep Generator

Adding conditional statementsAdding conditional statements

Custom checkPointsCustom checkPoints

Page 30: Qtp day 2

QTP ContinuedQTP Continued

Day4: Day4:

Advanced FeaturesAdvanced Features

Report and CommentReport and Comment

Splitting ActionSplitting Action

Virtual objectVirtual object

Page 31: Qtp day 2

QTP ContinuedQTP Continued

Day5: Day5:

Advanced QTPAdvanced QTP

Recovery scenarioRecovery scenario

Optional stepsOptional steps

Framework ApproachFramework Approach

Working with Dynamic ObjectsWorking with Dynamic Objects