qtp training day1

Upload: prasanna-kannan

Post on 07-Apr-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 QTP Training Day1

    1/39

    31 August 2011

    HP - QuickTest Professional

  • 8/4/2019 QTP Training Day1

    2/39

    31 August 2011 2

    Agenda (Day 1)

    Automated Tests vs Manual Tests

    Introduction to Test Automation Introduction to QTP

    Record / Playback The First Step

    Types of Recording

    What is Synchronization

    Checkpoints

  • 8/4/2019 QTP Training Day1

    3/39

    Automated Tests vs Manual Tests

    31 August 2011 3

  • 8/4/2019 QTP Training Day1

    4/39

    31 August 2011 4

    ADVANTAGES

    Automated Testing

    1. If you have to run a set of tests repeatedly

    automation is a huge gain.

    2. Helps performing "compatibility testing" -

    testing the software on different

    configurations.

    3. It gives you the ability to run automationscenarios to perform regressions in a

    shorter time.

    4. It gives you the ability to run regressions on

    a code that is continuously changing.

    5. Can be run simultaneously on different

    machines thus decreasing testing time.

    6. Long term costs are reduced.

    Manual Testing

    1. If Test Cases have to be run a small number

    of times it's more likely to perform manual

    testing.

    2. It allows the tester to perform more ad-hoc

    (random testing).

    3. Short term costs are reduced.4. The more time tester spends testing a

    module the greater the odds to find real

    user bugs.

  • 8/4/2019 QTP Training Day1

    5/39

    31 August 2011 5

    DISADVANTAGES

    Automated Testing

    1. It's more expensive to automate. Initial

    investments are bigger than manual testing.

    2. Cant automate visual references, some

    tests still have to be done manually.

    Manual Testing

    1. Manual tests can be very time consuming.

    2. For every release you must rerun the same

    set of tests which can be mundane and

    tiresome.

  • 8/4/2019 QTP Training Day1

    6/39

    Introduction to Test Automation

    31 August 2011 6

  • 8/4/2019 QTP Training Day1

    7/39

    31 August 2011 7

    Need of Automation

    Speed Automation Scripts run very fast when compared to human users

    (NOT ALWAYS) We can run automation scripts simultaneously on different machines without

    manual intervention.

    Reliable Tests perform precisely the same operations each time they are run, there by

    eliminating human error.

    Repeatable We can test how the application reacts after repeated execution of the same

    operation. We can rerun test cases for different set of test data.

    We can rerun test cases on different environment conditions.

    Comprehensive We can build a suite of tests that covers every feature in our application

    Reusable We can reuse tests on different versions of an application, even if the user interface

    changes.

  • 8/4/2019 QTP Training Day1

    8/39

    31 August 2011 8

    Rule of Thumb When to Automate and when not to?

    Is it possible to automate?Is it necessary to rerun this test again and again?

    Is ROI worth automating?

    Test automation success depends on robustness of the test cases not on the test tool.

    If it is not worth, DO NOT AUTOMATE.

    Use Common Sense

  • 8/4/2019 QTP Training Day1

    9/39

    31 August 2011 9

    What are the different tools available in the market- For

    Functional Test Automation

    QuickTest Professional (HP)

    WinRunner (HP)

    Robot (IBM Rational)

    Functional Tester (IBM Rational)

    SilkTest (Borland)

    TestComplete (AutomatedQA)

    QAWizard (Seapine)

    TestPartner (Compuware)

    QEngine (AdventNet)

    Ranorex (EOSS Group)

    Open source tools (Sahi, Selenium, Watir)

    Latest version of HP QuickTest Professional is 11.0 (called as HP Functional Testing )

  • 8/4/2019 QTP Training Day1

    10/39

    31 August 2011 10

    Criteria for selecting test automation tool

    1. Application to be tested

    2. Test environment3. Scope and limitation of the tool

    4. Feature of the tool

    5. Cost of the tool. Ease of use (Team expertise)

    6. Ease of Installation

    7. Multiple OS Support (As per project needs)

    8. Multiple Language Support (As per project needs)

    9. Integration with 3rd party tools (defect management tools or other tools)

    10. Report Generation

    11. Desktop/Web products testing

    12. Support for Data Driven testing (data stored in text / xml / excel file)

  • 8/4/2019 QTP Training Day1

    11/39

    31 August 2011 11

    Life Cycle Of Test Automation

    Analyze the Application

    Select the Tool

    Identify the Scripts (Feasibility Study)

    Design/ Record/Write/Enhance Test Scripts

    Run the Test Scripts

    Analyze the Test Results & Reporting the Defects

  • 8/4/2019 QTP Training Day1

    12/39

    Introduction to QTP

    31 August 2011 12

  • 8/4/2019 QTP Training Day1

    13/39

    31 August 2011 13

    Introduction to QTP

    Developed by Mercury Interactive now owned by HPQTP supports both web applications & windows applications

    Test Script developed on VB Script

    QTP supported Technology

    .NET. J2EE, Main Frame, XML, Java, Delphi, SAP, Seibel, People soft, Silverlight, Flex, Ajax,

    GWT, Dojo etc

    QTP run on only windows platform not supporting UNIX, Linux etcQTP supported multimedia

    RealAudio/RealVideo, Windows Media Player, Flash

  • 8/4/2019 QTP Training Day1

    14/39

    31 August 2011 14

    Environment needs for QTP 11.0

    System Requirement : Equivalent to Pentium IV or above

    Hardware Drive : 1GB of Free Disk space

    RAM : 1GB of RAM

    OS : MS Windows 2003 Server with Service Pack 2MS Windows XP with Service Pack 2 or 3

    MS Windows Vista with Service Pack 2

    MS Windows 2008 Server

    MS Windows 7

    Web Browser : MS Internet Explorer 6.0 and above

    Netscape Navigator 6.11, 6.22, 6.23, 7.02, 7.1

    AOL 8.0, 9.0

  • 8/4/2019 QTP Training Day1

    15/39

    31 August 2011 15

    Add-ins of QTP

    Technology supported by the QTP

    By default three Add-ins are there in QTPActiveXVBWeb

    Additional Add-ins:

    JavaOraclePeople soft.NETTerminal Emulator (RTE)SAPSiebelDelphi

  • 8/4/2019 QTP Training Day1

    16/39

    31 August 2011 16

    Window Structure of QTP

    1. Test Pane

    2. Active Screen

    3. Data Table

    4. Debug Viewer

    5. Information

    6. Missing

    Resources

  • 8/4/2019 QTP Training Day1

    17/39

    31 August 2011 17

    QTP 11.0 Features

    XPath and CSS based object identification

    Enhanced Results Viewer

    Easy Regular Expressions

    Identify objects in relation to neighboring objects using Visual Relation Identifier

    Load Function Libraries at Run Time by LoadFunctionLibrary statement

    Recording on Firefox Browser is now available

    Capable of receiving Java or .NET log framework messages from your application which canthen be embedded in the run results

    Can instruct QTP to automatically parameterize test steps at the end of record session

    Support WPF and Silverlight Application

  • 8/4/2019 QTP Training Day1

    18/39

    Record / Playback The First Step

    31 August 2011 18

  • 8/4/2019 QTP Training Day1

    19/39

    31 August 2011 19

    QuickTest Testing Process

    Recording

    Enhancing

    your test

    Debugging

    your test

    Running

    your test

    Analyzing

    the test results

    Reporting

    defects

    Preparing torecord

  • 8/4/2019 QTP Training Day1

    20/39

    31 August 2011 20

    Lets Record

    1. Open "http://newtours.demoaut.com/"website

    2. Click Record to start recording3. Login user name/password (default as mercury/mercury)

    4. Fill the "Flight finder" form

    5. Click "continue

    6. Select flight

    7. Click "continue

    8. Book the flight

    Run the test twice.

    Do you face some problem? Why?

    Start / End condition

    Note - View QTP generated file in Windows Explorer

  • 8/4/2019 QTP Training Day1

    21/39

    31 August 2011 21

    Analyzing Keyword View

    As you recorded your test, QuickTest generated steps in the Keyword View representing

    each operation you performed.The columns in the Keyword View show different information for each step, as follows:

    Item.The item for the step (test object, utility object, function call, or statement) ina hierarchical icon-based tree.

    Operation.The operation to be performed on the item, for example, Click or Select.

    Value.The argument values for the selected operation, for example, the mousebutton to use when clicking the image.

    Documentation.Auto-documentation of what the step does, in an easy-to-understand sentence, for example, Click the "findFlights" image.

    Assignment.The assignment of a value to or from a variable so you can use thevalue later in the test. This column is not visible by default.

    Comment.Any textual information you want to add regarding the step, for example,Return to page used in first step of the test. This column is not visible by default.

  • 8/4/2019 QTP Training Day1

    22/39

    Types of Recording

    31 August 2011 22

  • 8/4/2019 QTP Training Day1

    23/39

    31 August 2011 23

    Recording Modes in QTP

    Low Level Recording Mode

    1. Records

    Objects as Window test

    objects

    2. Useful for objects notrecognized by QTP

    3. Useful for objects whereexact co-ordinates arerequired

    Normal Recording Mode

    1. Default mode of recordingin QTP

    2. Records

    Objects in application

    Actions performed on them

    3. Object recognition isindependent of location ofthe object on the screen

    4. Uses QuickTest test objectmodel

    1. Records

    Exact mouse and

    keyboard movement in

    relation to screen or the

    application window

    2. Cannot edit analogrecording steps

    3. Useful for steps whichcannot be recorded atobject level.

    e.g. Signature

    4. Records every movementof mouse

    Analog Recording Mode

  • 8/4/2019 QTP Training Day1

    24/39

    31 August 2011 24

    Guidelines for Analog and Low Level Recording

    Analog

    Low Level

    Can switch recording modes in the middle of the recording sessions.

    Require more disk space than normal recording mode.

    Use only when normal recording mode does not accurately

    record your operation.

  • 8/4/2019 QTP Training Day1

    25/39

    31 August 2011 25

    Guidelines for Analog Recording

    Relative to the window

    Relative to the screen

    If the operations you perform are on objects located within one window

    and that window does not move during the analog recording session.QuickTest does not record any click or mouse movement performed

    outside the specified window.

    When using this mode, QuickTest does not capture any Active Screen

    images.

    If the operations you perform are on objects located within more than

    one window.

    QuickTest captures only the Active Screen image of the final state of the

    window on which we are recording.

    The steps recorded using analog recording are saved in a separate data

    file. This file is stored with the action in which the analog steps are

    recorded.

    QuickTest adds to our test, a RunAnalog statement that calls the

    recorded analog file.

  • 8/4/2019 QTP Training Day1

    26/39

    31 August 2011 26

    Analog Recording

    Open Programs > Accessories >Paintapplication.

    In Paint: Go to Image > Attributes and set thewidth and height to 900 pixels and click OK.

    In QuickTest: click the Record button to begina recording session.

    Click the Analog Recording button or chooseAutomation > Analog Recording. The AnalogRecording Settings dialog box opens

    Click AnalogRecording button

  • 8/4/2019 QTP Training Day1

    27/39

    31 August 2011 27

    Analog Recording Cont

    The Analog Recording Settings dialog boxopens

    There are 2 options available: Record relative to the screen

    Record relative to the following window

    Select Record relative to the followingwindow

    Click the pointing hand and click anywhere inthe Paint window on which you want to

    record in Analog Recording mode. The title ofthe window you clicked is displayed in thewindow title box.

  • 8/4/2019 QTP Training Day1

    28/39

    31 August 2011 28

    Analog Recording Cont

    Click Start Analog Record.

    Perform the operations you want to record in Analog Recording mode.

    When you are finished and want to return to normal recording mode, click the Analog Recordingbutton or choose Automation > Analog Recording to turn off the option.

    You should see the following statement in your script:

    Window("Paint").RunAnalog "Track1

    Note: Practice analog recording in Record relative to a specified window and Record relative tothe screen modes.

  • 8/4/2019 QTP Training Day1

    29/39

    31 August 2011 29

    Create a Script for Paint Application

    In Paint:

    1. Select File > New.

    2. Click on Pencil tool in the Tool Box.

    3. Click on color Red in the Color Box.

    4. Write the following text: QTP rules!!!

    5. Select File > New.

    6. In dialog box Paint click No to discard changes.

    In QuickTest:

    Use Standard Mode for steps 1-3 inclusively.

    Use Analog Mode for step 4.

    Use Standard Mode for steps 5-6 inclusively.

    Note: Create the script using the Record relative to a specified window mode.

  • 8/4/2019 QTP Training Day1

    30/39

    31 August 2011 30

    Low Level Recording Guidelines

    Use low-level recording for recording on environments or objects not supported by QuickTest.

    Use low-level recording for when you need to record the exact location of the operation on yourapplication screen. While recording in normal mode, QuickTest performs the step on an objecteven if it has moved to a new location on the screen. If the location of the object is important toyour test, switch to Low Level Recording to enable QuickTest to record the object in terms of its x-and y- coordinates on the screen. This way, the step will pass only if the object is in the correctposition.

    While low-level recording, QuickTest records all parent level objects as Window test objects andall other objects as WinObject test objects. They are displayed in the Active Screen as standardWindows objects.

    Low-level recording supports the following methods for each test object: Window test objects: Click, DblClick, Drag, Drop, Type, Activate, Minimize, Restore,

    Maximize

    Each step recorded in Low Level Recording mode is shown in the Keyword View and Expert View.(Analog recording records only the one step that calls the external analog data file.)

  • 8/4/2019 QTP Training Day1

    31/39

    31 August 2011 31

    Low Level Recording

    You can switch to Low Level Recording mode only while recording a test. The option is notavailable while editing a test.

    To record in Low Level Recording mode:1. Click the Record button to begin a recording session.

    2. Click the Low Level Recording button or choose Automation > Low Level Recording.

    The record mode changes to Low Level Recording and all of your keyboard input andmouse clicks are recorded based on mouse coordinates. When QuickTest runs the test,the cursor retraces the recorded clicks.

    3. When you are finished and want to return to normal recording mode, click the Low Level

    Recording button or choose Automation >Low

    Level Recording to turn off the option.

    Class work: Record Exercise 1 in Low Level Recording mode. Use the mix of different modes tomake the script work.

  • 8/4/2019 QTP Training Day1

    32/39

    31 August 2011 32

    Low Level Recording Cont

    The examples below illustrate the difference between the same operations recorded usingNormal Recording Mode and Low Level Recording mode.

    In the Normal Recording Mode your test is displayed as follows in the Keyword View and ExpertView:

    Window("Notepad").WinEditor("Edit").Type "This is a sample test

    If you perform the same action while in Low Level Recording Mode, QuickTest records the click inthe Edit box, followed by the keyboard input. Your test is displayed as follows in the KeywordView and Expert View:

    Window("Notepad").WinObject("Edit").Click 17,27

    Window("Notepad").WinObject("Edit").Type "This is a sample test"

  • 8/4/2019 QTP Training Day1

    33/39

    Synchronization in QTP

    31 August 2011 33

  • 8/4/2019 QTP Training Day1

    34/39

    31 August 2011 34

    What is Synchronization

    Inserts a synchronization point in the test, instructing QuickTest to pause the test until the objectproperty value is achieved (or times out).

    There are several options that you can use to synchronize your test:

    You can insert a synchronization point by choosing Insert > Synchronization Point, and QuickTestgenerates a WaitProperty statement in the Expert View.

    You can insert Exist or Wait statements that instruct QuickTest to wait until an object exists or towait a specified amount of time before continuing the test.

    You can modify the default amount of time that QuickTest waits for a Web page to load bychanging Browser Navigation Timeout in the File > Settings > Web tab.

    When working with tests, you can increase the default timeout settings for a test to instruct

    QuickTest to allow more time for objects to appear by changing the Object SynchronizationTimeout in the File > Settings > Run tab.

  • 8/4/2019 QTP Training Day1

    35/39

    Checkpoints in QTP

    31 August 2011 35

  • 8/4/2019 QTP Training Day1

    36/39

    31 August 2011 36

    Types of Checkpoints

    A checkpoint verifies that expected information is displayed in your application while the test isrunning.

    Types of various checkpoints:

    1. Standard Check Point : Checks the property value of an object in your application or Web page.Standard checkpoints are supported for all add-in environments.

    2. Bitmap Check Point : Checks an area of your Web page or application as a bitmap. For example,

    suppose you have a Web site that can display a map of a city the user specifies. Bitmapcheckpoints are supported for all add-in environments

    3. Database Check Point : Checks the contents of a database accessed by your application.Database checkpoints are supported by all environments

    4. Text Check Point : Checks that a text string is displayed in the appropriate place on a Web pageor application. Text checkpoints are supported for the Web environment, plus some Web-based

    add-in environments.

    5. Text Area Check Point : Checks only the text string captured from the defined area is displayed(Text Before and Text After are not displayed).

  • 8/4/2019 QTP Training Day1

    37/39

    31 August 2011 37

    Types of Checkpoints Cont...

    6. Accessibility Check Point : Identifies areas of your Web site that may not conform to the World

    Wide Web Consortium (W3C) Web Content Accessibility Guidelines. Accessibility checkpoints are

    supported for the Web environment

    7. XML Check Point - Web page : Checks the data content of XML documents in Web pages and

    frames. The XML Checkpoint (Web Page/Frame) option is supported for the Web environment.

    8. XML Check Point - File : Checks the data content of XML documents in XML files. The XML

    Checkpoint option is supported for all environments

  • 8/4/2019 QTP Training Day1

    38/39

    31 August 2011 38

    Standard Checkpoints

    Standard Checkpoints checks the property value of an object in your application or Web page. Thestandard checkpoint checks a variety of objects such as buttons, radio buttons, combo boxes, lists,

    and so forth.

    Using Standard Checkpoints, we can create following checkpoints:

    Image checkpoint : checks the value of an image in your application or Web page. Imagecheckpoints are supported for the Web environment

    Table checkpoint: checks information within a table. For example, suppose your applicationor Web site contains a table listing all available flights from New York to San Francisco. Youcan add a table checkpoint to check that the time of the first flight in the table is correct.

    Page checkpoint: checks the characteristics of a Web page. For example, you can check howlong a Web page takes to load or whether a Web page contains broken links. Page

    checkpoints are supported for the Web environment

  • 8/4/2019 QTP Training Day1

    39/39

    31 August 2011

    Thank you.