Automation Fundamentals Qtp

Embed Size (px)

Citation preview

  • 8/8/2019 Automation Fundamentals Qtp

    1/41

    Contact:[email protected]+91-9986108024

    Automation FundamentalConcepts and Intro.

    about QTP 9.2

    --Chandra Sekhar

  • 8/8/2019 Automation Fundamentals Qtp

    2/41

    Contact:[email protected]+91-9986108024

    Automation Fundamental Concepts

    What is Test Automation ?

    Software Test Automation is the process of automating the steps of manual test

    cases using an automation tool Or utility to shorten the testing life cycle with

    respect to time

    When application undergoes regression, some of the steps might be missed out

    or skipped which can be avoided in Automation

    Automation helps to avoid human errors and also expedite the testing

    process

    To implement the Test Automation detailed planning and effort is required

  • 8/8/2019 Automation Fundamentals Qtp

    3/41

    Contact:[email protected]+91-9986108024

    Automation Fundamental Concepts

    Automation saves time and effort which results in reduction of the Test lifecycle

    Benefits of Automation

    - Consistency of Test Execution

    - Reducing cycle time of regression test cycles

    - Data driven testing

    - Repeatability

    - Coverage

    - Reliability- Reusability of test wares

  • 8/8/2019 Automation Fundamentals Qtp

    4/41

    Contact:[email protected]+91-9986108024

    Automation Fundamental Concepts

    Automation life cycle is a subset of the entire test life cycle Automation planning can be initiated in parallel to the test planning phase

    Factors to be considered in automation planning,

    Stability of AUT (Application under test) No of regression cycles to be performed

    Compatibility of App platform with testing tools

    Cost benefit analysis (ROI)

    Availability of skilled resources

  • 8/8/2019 Automation Fundamentals Qtp

    5/41

    Contact:[email protected]+91-9986108024

    Regression Testing & Automation

    When Automation is applicable?

    Regression Testing Cycles are long and iterative.

    If the application is planned to have multiple releases / builds

    If its a long running application where in small enhancements / Bug Fixes

    keeps happening

    Test Repeatability is required

  • 8/8/2019 Automation Fundamentals Qtp

    6/41

    Contact:[email protected]+91-9986108024

    Technologies Supported

    Default Support

    1. Standard Windows applications

    2. Web objects / Applications

    3. ActiveX controls

    4. Visual Basic applications

    Supported Add-ins

    QuickTest Professional Java Add-in 9.1QuickTest Professional .NET Add-in 9.2

    QuickTest Professional Oracle Add-in 8.2

    QuickTest Professional PeopleSoft Add-in 8.2*

    QuickTest Professional Add-in 8.2 for SAP Solutions

    QuickTest Professional Siebel Add-in 8.0*

    QuickTest Professional Stingray Add-in 8.2

    QuickTest Professional Terminal Emulator Add-in 8.0*

    QuickTest Professional VisualAge Smalltalk Add-in 8.2

    QuickTest Professional Web Services Add-in 9.2

  • 8/8/2019 Automation Fundamentals Qtp

    7/41

    Contact:[email protected]+91-9986108024

    Supported Browsers

    Microsoft Internet Explorer 6.0 Service Pack 1

    Microsoft Internet Explorer 7.0

    Netscape Browser 8.1.2

    Mozilla Firefox 1.5

    Mozilla Firefox 2.0

  • 8/8/2019 Automation Fundamentals Qtp

    8/41

    Contact:[email protected]+91-9986108024

    Add-in Manager

    Default Add-ins

    ActiveX

    Visual basic

    Web

    Other Add-Ins

    Siebel

    Java

    SAP

    Oracle .Net and many more

  • 8/8/2019 Automation Fundamentals Qtp

    9/41

    Contact:[email protected]+91-9986108024

    Add-in Manager Cont

    QTPs Add-in Manager facilitates the users to select the technology /

    environment from variety of environments suitable for the AUT (Application

    Under Test)

    Once an add-in is loaded, users can record that application in its supported

    environment and thus QTP recognizes the objects specific to the applicationunder test (AUT) as loaded through Add-in Manager.

    It is critical for the users to know the development technologies / environment of

    AUT, and load right Add-Ins while invoking Quick Test Pro.

  • 8/8/2019 Automation Fundamentals Qtp

    10/41

    Contact:[email protected]+91-9986108024

    Quick Test Professional - Record &

    Run Modes

    Recording Modes Normal

    Analog

    Low level

    Run Modes

    Normal

    Fast

    Update

  • 8/8/2019 Automation Fundamentals Qtp

    11/41

    Contact:[email protected]+91-9986108024

    Quick Test Professional -Tools

    Options General

    Click on Restore Layout button to reset screens to the initial setting when

    QuickTest was first installed.

  • 8/8/2019 Automation Fundamentals Qtp

    12/41

    Contact:[email protected]+91-9986108024

    Quick Test Professional - Tools

    Options Run

  • 8/8/2019 Automation Fundamentals Qtp

    13/41

  • 8/8/2019 Automation Fundamentals Qtp

    14/41

  • 8/8/2019 Automation Fundamentals Qtp

    15/41

    Contact:[email protected]+91-9986108024

    Record and Run Settings

    Best Practices for Record & Run Settings Set the options to configure QTP to "Record and run test on any open

    Windows- based application

    Set the option - This window will appear the first time you click on theRecord button in the new test.

    Manually recall this window by selecting AutomationRecord and Run

    settings

  • 8/8/2019 Automation Fundamentals Qtp

    16/41

    Contact:[email protected]+91-9986108024

    QTP - Main Window

  • 8/8/2019 Automation Fundamentals Qtp

    17/41

    Contact:[email protected]+91-9986108024

    QTP - Main Window

    Test Pane: Test Pane contains two labs to view the tests,

    - Keyword View

    - Expert View

    Keyword View: Quick Test Pro displays your test in the form of a collapsible, icon

    based tree

    Expert View:

    Quick Test Pro displays the source code (VB Script) of the tests in this

    view.

  • 8/8/2019 Automation Fundamentals Qtp

    18/41

    Contact:[email protected]+91-9986108024

    Resources Object Repository

    Can add a

    New Object to

    the repository

    More properties for

    recognizing the object

    can be added to the list.

    The value of property

    can be edited here.

  • 8/8/2019 Automation Fundamentals Qtp

    19/41

    Contact:[email protected]+91-9986108024

    Resources Object Repository Manager

  • 8/8/2019 Automation Fundamentals Qtp

    20/41

    Contact:[email protected]+91-9986108024

    Resources Associate Repositories

    Add shared Repository

  • 8/8/2019 Automation Fundamentals Qtp

    21/41

    Contact:[email protected]+91-9986108024

    Resources Object Repository

    Associate repository is

    added to the Filter

    option.

  • 8/8/2019 Automation Fundamentals Qtp

    22/41

  • 8/8/2019 Automation Fundamentals Qtp

    23/41

    Contact:[email protected]+91-9986108024

    Object Repository Comparison Tool

    Comparing two

    repositories'

  • 8/8/2019 Automation Fundamentals Qtp

    24/41

    Contact:[email protected]+91-9986108024

    VB Script basics Data Types

  • 8/8/2019 Automation Fundamentals Qtp

    25/41

    Contact:[email protected]+91-9986108024

    VB Script basics Variables & Constants

    Declaring Variables

    Naming Restrictions

    Scope and Lifetime of Variables

    Assigning Values to Variables

    Scalar Variables and Array Variables

    Creating Constants

  • 8/8/2019 Automation Fundamentals Qtp

    26/41

    Contact:[email protected]+91-9986108024

    VB Script basics - Operators

  • 8/8/2019 Automation Fundamentals Qtp

    27/41

    Contact:[email protected]+91-9986108024

    VB Script basics Conditions & Looping

    Conditional Statements If...Then...Else statement Select Case statement

    Looping Do...Loop: Loops while or until a condition is true.

    While...Wend: Loops while a condition is true.

    For...Next: Uses a counter to run statements a specified number of times.

    For each...Next: Repeats a group of statements for each item in a collectionor each element of an array.

  • 8/8/2019 Automation Fundamentals Qtp

    28/41

  • 8/8/2019 Automation Fundamentals Qtp

    29/41

    Contact:[email protected]+91-9986108024

    Key areas in QTP

    About the script structure Actions (Simple, Nested, External, Re-usable)

    Parameterization (Different Types)

    Checkpoints (Programmatic Methodology)

    Descriptive programming

    Adv. Synchronization points Exception Handling

  • 8/8/2019 Automation Fundamentals Qtp

    30/41

    Contact:[email protected]+91-9986108024

    About the script structure

  • 8/8/2019 Automation Fundamentals Qtp

    31/41

    Contact:[email protected]+91-9986108024

    Actions (Simple, Nested, External, Re-usable)

    Standalone Actions Nested Actions Integration of Actions (Call from One Action to other) Driver Action (Main Action) Re-usable Actions External Call for Actions

  • 8/8/2019 Automation Fundamentals Qtp

    32/41

    Contact:[email protected]+91-9986108024

    Parameterization

    Classifications of Parameterization Test and Action Parameters

    Data Table (Global & Action Specific)

    Environment variables

    Random Number

  • 8/8/2019 Automation Fundamentals Qtp

    33/41

    Contact:[email protected]+91-9986108024

    Types of Checkpoints

    Check that a Web page (or any

    portion of it) is displayed as

    expected.

    Checks an area of a Web page

    or application after capturing

    it as a bitmap

    Bitmap Checkpoint

    Check whether the expected

    text string is displayed in the

    expected location on a Web

    page or dialog box

    Checks that a text string is displayed in

    the appropriate place in a Web page or

    application window

    Text /

    Text Area Checkpoint

    Check how long a Web pagetakes to load or if a Web page

    contains broken links.

    Checks the characteristics of a Web pagePage checkpoint

    Check that the value in a table

    cell is correct.

    Checks information in a tableTable Checkpoint

    Check that the image source file

    is correct.

    Checks the property values of

    an image

    Image Checkpoint

    Check that a radio button isselected.

    Checks values of an objects propertiesStandard Checkpoint

  • 8/8/2019 Automation Fundamentals Qtp

    34/41

    Contact:[email protected]+91-9986108024

    Types of Checkpoints

    Note: XML file checkpointsare used to check aspecified XML file; XMLapplication checkpoints are

    used to check an XMLdocument within a Webpage.

    Checks the data content ofXML documents

    XML Checkpoint

    Check if the images on aWeb page include ALTproperties, required by the

    W3C Web ContentAccessibility Guidelines.

    Identifies areas of a Web siteto check for Section 508compliancy

    AccessibilityCheckpoint

    Check that the value in adatabase query is correct.

    Checks the contents of databasesaccessed by an application or Website

    DatabaseCheckpoint

  • 8/8/2019 Automation Fundamentals Qtp

    35/41

    Contact:[email protected]+91-9986108024

    Descriptive Programming Samples

    Descriptive programming

    Entering Programmatic Descriptions Directly into Statements

    Browser("Mercury Tours").Page("Title:=Mercury

    Tours").WebEdit("Name:=Author", "Index:=3").Set "Mark Twain"

    Using Description Objects for Programmatic Descriptions

    Set MyDescription = Description.Create()

    MyDescription("text").Value = "OK"

    MyDescription("width").Value = 50

    Window("Error").WinButton(MyDescription).Click

  • 8/8/2019 Automation Fundamentals Qtp

    36/41

    Contact:[email protected]+91-9986108024

    Adv. Synchronization Points

    Using tool menu options

    Wait property

    Programmatically

    Wait & exist

  • 8/8/2019 Automation Fundamentals Qtp

    37/41

    Contact:[email protected]+91-9986108024

    Exception Handling

    Recovery Scenario Concepts

    Recovery Process

    Trigger Events

    Recovery Operation

    Post-recovery Operation

  • 8/8/2019 Automation Fundamentals Qtp

    38/41

    Contact:[email protected]+91-9986108024

    Sample Script QTP Functions

    'sample 1 - Getting all the items from the combobox My_Cnt = Window("Flight Reservation").WinComboBox("Fly

    From:").GetItemsCount msgbox My_Cnt

    For i = 1 to My_Cnt ' the combobox item index will start from zero. My_item = Window("Flight Reservation").WinComboBox("Fly

    From:").GetItem(i-1) Msgbox My_item Next

    'sample 2 - Getting the entire content of the combobox Var_Content = Window("Flight Reservation").WinComboBox("FlyFrom:").GetContent

    Msgbox Var_Content

  • 8/8/2019 Automation Fundamentals Qtp

    39/41

    Contact:[email protected]+91-9986108024

    Sample Script QTP Functions

    'sample 3 - Selecting an item from the combo - Using Index

    Window("Flight Reservation").WinComboBox("Fly From:").Select(5)

    'sample 4 - Selecting an item from the combo - Using Value

    Window("Flight Reservation").WinComboBox("Fly From:").Select("London")

    'sample 5 - Selecting an item from the combo - Using Variable

    Var_Item = "Zurich"

    Window("Flight Reservation").WinComboBox("Fly From:").Select(Var_Item)

    'sample 6 - Getting the value of selected item

    Var_Sel = Window("Flight Reservation").WinComboBox("Fly From:").GetSelection Msgbox Var_Sel

  • 8/8/2019 Automation Fundamentals Qtp

    40/41

    Contact:[email protected]+91-9986108024

    Sample Script QTP Functions

    ' Some FUM's (Frequently Used Methods)

    'GetROProperty Var_Text = Window("Flight

    Reservation").WinEdit("Name:").GetROProperty("AttachedText") Msgbox Var_Text Var_Enab = Window("Flight

    Reservation").WinEdit("Name:").GetROProperty("Enabled") Msgbox Var_Enab

    'Exist If Window("Flight Reservation").WinEdit("Name:").Exist(5) Then Msgbox "The Editbox exists" Else Msgbox "The Editbox does not exist" End if

  • 8/8/2019 Automation Fundamentals Qtp

    41/41

    Contact:[email protected]

    Thank You