Recording Process
It is a Process of Recording user operations on AUT (Application Under Test). During Recording QTP Creates steps in Keyword view, and generates them in a script in the Expert view. Simultaneously it adds Objects information into Object Repository.
Steps for preparing a test
1) Start recording on a Mercury Tours Web site.
Choose Automation > Record and Run Settings or click the Record button. The Record and Run Settings dialog box opens.
In the Web tab, Select Open the following browser when a record or run
session begins.
Choose a browser from the Type list and confirm that the URL in the Address box is http://newtours.demoaut.com/
Confirm that Close the browser when the test closes and Do not record and run on browsers that are already open are selected.
In the Windows Applications tab, confirm that Record and run only on is selected, and that there are no
applications listed.
This setting prevents you from inadvertently recording operations performed on various Windows applications (such as e-mail) during a recording session.
Click OK.
QuickTest begins recording, and your browser opens to the Mercury Tours Web site.
2) Log in to the Mercury Tours Web site.
Enter the user name as tutorial and password as tutorial
Click Sign-In.
The Flight Finder page opens.
3) Enter flight details.
Change the following selections by choosing from the drop-down list. (Do not use the calendar option.)
Click CONTINUE to accept the other default selections.
4) The Select Flight page opens.
Select a flight.
Click CONTINUE to accept the default flight selections.
5) The Book a Flight page opens.
Enter required passenger and purchase information as follows.
For: | |
cc_exp_dt_mm | |
cc_exp_dt_yr |
In the Billing Address section, select Ticketless Travel.
At the bottom of the page, click SECURE PURCHASE.
6) The Flight Confirmation page opens.
7) Review and complete your booking.
8) Click BACK TO HOME. The Mercury Tours home page opens. Stop recording.
(In QuickTest, click Stop on the Testing toolbar to stop the recording process)
You have now reserved an imaginary business class ticket from New York to San Francisco. QuickTest recorded your Web browser operations from the time you clicked the Record button until you clicked the Stop button.
9) Save your test.
Select File > Save or click the Save button. The Save dialog box opens to the
Tests folder.
Create a folder named Tutorial, select it, and click Open.
Type Recording in the File name field.
Confirm that Save Active Screen files is selected.
Click Save. The test name (Recording) is displayed in the title bar of the main QuickTest window.
The following code is displayed in the test window.
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "tutorial"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "4e4255b8610826b78d5050f48a3cda41434e23f42c92"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 23,9
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").Select "New York"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromMonth").Select "December"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromDay").Select "29"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toPort").Select "San Francisco"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "December"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toDay").Select "31"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Image("findFlights").Click 49,10
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Image("reserveFlights").Click 89,11
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passFirst0").Set "passFirst0"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passLast0").Set "passLast0"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("creditCard").Select "MasterCard"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("creditnumber").Set "12345678"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("cc_exp_dt_mn").Select "01"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("cc_exp_dt_yr").Select "2008"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebCheckBox("ticketLess").Set "ON"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Image("buyFlights").Click 11,4
Browser("Welcome: Mercury Tours").Page("Flight Confirmation: Mercury").Image("home").Click
Running Process
During Running QTP reads statements one by one and gets Object Information from the Object Repository, based on that Information performs operations on AUT.
Steps for running a test
- Open the previously saved file Recording from the Tutorial folder.
- Start running your test.
Watch carefully as QuickTest opens your browser and starts running the test. In the browser, you can see QuickTest perform each step you inserted; a yellow arrow in the left side of each step in the Expert View Window indicates the step that QuickTest is running.
When QuickTest finishes running the test, the Run Results Viewer opens.
Initially, the Run Results Viewer displays the following panes:
- Run Results Tree pane. A graphical representation of the results in an expandable tree, organized according to the actions and the Web pages visited during the test run and can be expanded (arrow) to view each step. The steps performed during the run are represented by icons in the tree. You can instruct QuickTest to run a test or action more than once using different sets of data in each run. Each run is called an iteration, and each iteration is numbered. (The test you ran had only one iteration.)
- Result Details pane. A high-level results overview report, containing general information about the test, which steps passed or failed, statistics in pie chart format, and so on.
- Captured Data pane. A still image of the state of your application at a particular step.
Your test run succeeded because QuickTest was able to navigate the Mercury Tours site according to the steps that you added.
3. Close the Run Results Viewer. Choose File > Exit.
You have now successfully created and run a test that reserves a flight from New York to San Francisco on the Mercury Tours Web site.
Recording Modes
There are three types of recording modes available in QuickTest Pro.
1.Normal mode
2.Analog mode
3.Low-level recording mode
Normal mode: 1.Normal mode
2.Analog mode
3.Low-level recording mode
This is the default mode of recording in QTP ,Object and the Operation associated/performed with Object can be recorded.This mode takes full advantage of QuickTest's test object model,recognizing the objects in AUT regardless of their location on the screen.
When working with specific types of objects or operations, however, you may want to choose from the following, alternative recording modes:
Analog mode:
This mode records exact mouse and keyboard operations you perform in relation to the screen / application window.This mode is useful for the operation which you can record at object level,such as drawing a picture, recording signature.the steps recoded using Analog mode are saved in seperate data-file, Quick tests adds to your test a Run Analog file statement that calls the recorded Analog file.This file is stored with your action in which these Analog steps are created.The steps recorded in Analog mode can not be edited within QuickTest.
To record in Analog Recording mode:
- If you are not already recording, click the Record button to begin a recording session.
- Click the Analog Recording button or select Automation > Analog Recording.
The Analog Recording Settings dialogue box has the following options:
- Record relative to the screen. QTP records any mouse movement or keyboard input relative to the coordinates of your screen, regardless of which application(s) are open or which application(s) you specified in the Record and Run Settings dialog box.
Select Record relative to the screen if you perform your analog operations on objects located within more than one window or if the window itself may move while you are recording your analog operations.
Note: When you record in Analog Recording mode relative to the screen, the run session will fail if your screen resolution or the screen location on which you recorded your analog steps has changed from the time you recorded.
The analog tracking continues to record the movement of the mouse until the mouse reaches the QTP screen to turn off Analog Recording or to stop recording. Clicking on the QTP icon in the Windows taskbar is also recorded. This should not affect your test. The mouse movements and clicks on the QTP screen itself are not recorded.
The analog tracking continues to record the movement of the mouse until the mouse reaches the QTP screen to turn off Analog Recording or to stop recording. Clicking on the QTP icon in the Windows taskbar is also recorded. This should not affect your test. The mouse movements and clicks on the QTP screen itself are not recorded.
- Record relative to the following window. QTP records any mouse movement or keyboard input relative to the coordinates of the specified window.
Select Record relative to the following window if all your operations are performed on objects within the same window and that window does not move during analog recording. This guarantees that the test will run the analog steps in the correct position within the window even if the window's screen location changes after recording.
Note: If you have selected to record in Analog Recording mode relative to a window, any operation performed outside the specified window is not recorded while in Analog Recording mode.
3. If you choose to Record relative to the following window, click the pointing hand and click anywhere in the window on which you want to record in Analog Recording mode. The title of the window you clicked is displayed in the window title box.
Low-level recording mode:
Enables you to record any object or operation in your AUT whether or not QuickTest recognizes the it.This Low-level recording is useful when the exact location of an Object/operation in your AUT is important for your test.This mode records in terms of X,Y co-ordinates.Unlike in Analog mode,the steps can be seen in Test script,as well in Keyword view. This mode records at the object level and records all run-time objects as Window or WinObject test objects.
To record in low-level recording mode:
- If you are not already recording, click the Record button to begin a recording session.
- Click the Low Level Recording button or select Automation > Low Level Recording.
- When you finished recording and want to return to normal recording mode, click the Low Level Recording button or select Automation > Low Level Recording to turn off the option.
Advantages of Recording
- It is used for Analyzing the AUT in the initial stage to find out weather the QTP tool is Recognizing all of our Application Objects or not
- It is easy to create Tests / Test Scripts
- It is used for frequently changing UI (User Interface)
- It takes less time to create Tests
Drawbacks of Recording
- It occupies a lot of memory space(due to duplicate objects), So QTP performance will be reduced
- No Centralized Maintenance mechanism, So Modifications are very difficult
- User may not have command on the Recorded script, So locating errors is difficult
- Recorded scripts are QTP internal files, they may corrupt
No comments:
Post a Comment