qtp study

Upload: govind-prakash

Post on 29-May-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 QTP Study.

    1/27

    What is QTPWhat is QTP

    QTP stands QuickTest ProfessionalQTP stands QuickTest ProfessionalIt is an automated testing tool provided byIt is an automated testing tool provided byHP/Mercury InteractiveHP/Mercury InteractiveQTP integrates with other Mercury testingQTP integrates with other Mercury testingsolutions including:solutions including:

    TestDirector/Quality CenterTestDirector/Quality CenterWinRunnerWinRunner

    LoadRunnerLoadRunnerU tilizes an addU tilizes an add- -in architecture for compactnessin architecture for compactnessand extensibilityand extensibility

  • 8/9/2019 QTP Study.

    2/27

    Types of TestingTypes of Testing

    ManualManualU sage of steps defined within test cases toU sage of steps defined within test cases tomanually test the application to ensure that it manually test the application to ensure that it functions properlyfunctions properly

    A utomated A utomatedA utomation of the manual testing process to all A utomation of the manual testing process to allunattended execution and ensure repeatabilityunattended execution and ensure repeatability

  • 8/9/2019 QTP Study.

    3/27

    Benefits of A utomated TestingBenefits of A utomated Testing

    SpeedSpeedA utomated tests are fast and can execute at a speed A utomated tests are fast and can execute at a speedfaster than a person can clickfaster than a person can click

    ReliableReliableThe tests can perform the exact same steps every timeThe tests can perform the exact same steps every timewithout concern about human errorwithout concern about human error

    RepeatableRepeatable

    Y ou run the same test against multiple builds/versions Y ou run the same test against multiple builds/versionsof an applicationof an applicationReusableReusable

    Can be reused as a subCan be reused as a sub- -part of different testspart of different tests

  • 8/9/2019 QTP Study.

    4/27

    What Should Be A utomatedWhat Should Be A utomated

    Good candidatesGood candidatesTests executed for each buildTests executed for each buildBusiness critical testsBusiness critical testsTests that are difficult/tedious to perform manuallyTests that are difficult/tedious to perform manually

    Bad candidatesBad candidates

    Tests without predictable resultsTests without predictable resultsTest that require variable input/responses from theTest that require variable input/responses from thetestertesterTests that perform operations in multiple environmentsTests that perform operations in multiple environments

  • 8/9/2019 QTP Study.

    5/27

    QTP Environment QTP Environment

    WindowsWindowsC++, Visual Basic, Java, .NETC++, Visual Basic, Java, .NET

    WebWebWeb A pplications, Web services, FlashWeb A pplications, Web services, Flash

    O ther technologiesO ther technologies

    S A

    P, Siebel,O

    racle, Peoplesoft, A

    ctiveX S A

    P, Siebel,O

    racle, Peoplesoft, A

    ctiveX

  • 8/9/2019 QTP Study.

    6/27

    A dd A dd--in A rchitecturein A rchitecture

    Enables QTP to provide support for multiple technologies.Enables QTP to provide support for multiple technologies.

    A dd A dd--ins are software that need to be installed on a systemins are software that need to be installed on a system

    that has QTP. It then becomes integrated with the QTPthat has QTP. It then becomes integrated with the QTPenvironment.environment.

    QTP is sold with the ability to understand a few technologies,QTP is sold with the ability to understand a few technologies,addadd--ins provide QTP with the ability to understand additionalins provide QTP with the ability to understand additional

    technologiestechnologies

    Users are able to select the specific addUsers are able to select the specific add- -ins for theins for thetechnologies they are testing thereby reducing the memorytechnologies they are testing thereby reducing the memoryfootprint of QTPfootprint of QTP

  • 8/9/2019 QTP Study.

    7/27

  • 8/9/2019 QTP Study.

    8/27

    Testing ProcessTesting Process

    Create O bject RepositoryCreate O bject RepositoryCreate TestsCreate Tests

    RecordRecord

    Edit Edit Insert checkpointsInsert checkpointsInsert synchronization pointsInsert synchronization pointsInsert output valuesInsert output valuesParameterize test Parameterize test Include V BScript codeInclude V BScript code

    Debug test Debug test Run testsRun tests

  • 8/9/2019 QTP Study.

    9/27

    Introduction To ExpenseCalculatorIntroduction To ExpenseCalculator

    Windows based application written in Visual BasicWindows based application written in Visual Basic

    A vailable at A vailable at http://www.genixcorp.com/testing/ExpenseCalculator.ziphttp://www.genixcorp.com/testing/ExpenseCalculator.zip

    A llows individuals to track expenses A llows individuals to track expenses

    Uses a local A ccess databaseUses a local A ccess database

  • 8/9/2019 QTP Study.

    10/27

    What is a QTP Test What is a QTP Test

    It is called a test script but is actually aIt is called a test script but is actually afolder containing several filesfolder containing several files

    Broken down into subparts known asBroken down into subparts known as' A ctions' A ctions

    Internally represented using the V BScript Internally represented using the V BScript programming languageprogramming language

  • 8/9/2019 QTP Study.

    11/27

    A ctions A ctions

    A test is broken into a series of A ctions A test is broken into a series of A ctions A ctions can be renamed to reflect what they do A ctions can be renamed to reflect what they do

    A ctions can be invoked multiple times within a A ctions can be invoked multiple times within atest test

    A ctions can be marked as reusable so they can A ctions can be marked as reusable so they canbe called from other testsbe called from other tests

    O nly reusable actions can be called from other testsO nly reusable actions can be called from other tests

  • 8/9/2019 QTP Study.

    12/27

    O verview QTP ToolO verview QTP Tool

    MenusMenus

    ToolbarToolbar

    Provides easy access to items on the menusProvides easy access to items on the menus

    Record & Run SettingsRecord & Run Settings

    Test SettingsTest Settings

    ToolsTools

  • 8/9/2019 QTP Study.

    13/27

    QTP Tool [Code Window]QTP Tool [Code Window]

    Provides a W Y SIW Y G editor to use inProvides a W Y SIW Y G editor to use inwriting your test script writing your test script

    K eyboard viewK eyboard viewProvides an iconProvides an icon- -based representation of the codebased representation of the codebeing written. This is often the easiest code view forbeing written. This is often the easiest code view fornonnon--programmersprogrammers

    Expert ViewExpert ViewProvides a V BScript code based representation of theProvides a V BScript code based representation of thecode being written. This is the most flexible codecode being written. This is the most flexible code

  • 8/9/2019 QTP Study.

    14/27

    QTP Tool [Views]QTP Tool [Views]

    A ctive Screen A ctive ScreenProvides screenshots of all objects recorded andProvides screenshots of all objects recorded andalso supports object highlightingalso supports object highlighting

    Data TableData TableShows the data file that can be used toShows the data file that can be used toconfigure the applicationconfigure the application

    Debug ViewerDebug ViewerProvides tools to debug code and view the valueProvides tools to debug code and view the valueof variable/expression during code executionof variable/expression during code execution

  • 8/9/2019 QTP Study.

    15/27

    Create O bject Repository [STEP 1]Create O bject Repository [STEP 1]

    Intro to O bject O riented ProgrammingIntro to O bject O riented Programming

    O bjects are a representation of every item found in anO bjects are a representation of every item found in anapplicationapplicationO bjects are visual (e.g. Button, Textbox) and nonO bjects are visual (e.g. Button, Textbox) and non- -visualvisual(e.g. Dictionary, Reporter) elements within an application.(e.g. Dictionary, Reporter) elements within an application.Each object has the following elementsEach object has the following elements

    Properties, Methods & EventsProperties, Methods & EventsA ll objects must have a unique name and belong to a A ll objects must have a unique name and belong to aclass.class.O bjects are referenced in code using dot notationO bjects are referenced in code using dot notation

    objectName.Method()objectName.Method()

  • 8/9/2019 QTP Study.

    16/27

    O bjectsO bjects

    PropertiesPropertiesThese are characteristics of the object e.g. the text These are characteristics of the object e.g. the text on a button. QTP uses this to recognize the object on a button. QTP uses this to recognize the object

    MethodsMethodsThese are built in functionality of the object. TheThese are built in functionality of the object. The

    VBScript code that we write (or record) actually makes calls to the VBScript code that we write (or record) actually makes calls to themethods of an object e.g. Reporter.ReportEvent()methods of an object e.g. Reporter.ReportEvent()Here ReportEvent is the method of the Reporter object Here ReportEvent is the method of the Reporter object

    EventsEventsThese are what can be done to an object. This is used byThese are what can be done to an object. This is used byprogrammers to determine what an object does in response to anprogrammers to determine what an object does in response to anaction you perform. It is however unused in QTP.action you perform. It is however unused in QTP.

  • 8/9/2019 QTP Study.

    17/27

    QTP O bject Identification ProcessQTP O bject Identification Process

    O bject IdentificationO bject IdentificationThe tool determines what properties of objects areThe tool determines what properties of objects arerecordedrecorded

    O bject SpyO bject SpyA llows users to view the property of an object without A llows users to view the property of an object without recording it recording it

    O bject RepositoryO bject RepositoryHolds information recorded about each object allowingHolds information recorded about each object allowingthe test to identify the object during executionthe test to identify the object during execution

  • 8/9/2019 QTP Study.

    18/27

    Creating an O bject RepositoryCreating an O bject Repository

    Per A ctionPer A ctionA n object repository is created for each action A n object repository is created for each action

    This means that multiple object repositories canThis means that multiple object repositories canbe created per test be created per test

    SharedSharedA single objected repository is used for multiple A single objected repository is used for multipleteststests

  • 8/9/2019 QTP Study.

    19/27

    CRE A TE TEST [STEP 2]CRE A TE TEST [STEP 2]

    Record StepsRecord StepsEdit Edit

    Insert synchronization pointsInsert synchronization pointsInsert checkpointsInsert checkpointsInsert output valuesInsert output valuesParameterize valuesParameterize valuesInclude V BScript codeInclude V BScript code

  • 8/9/2019 QTP Study.

    20/27

    RecordRecord

    Read the outline of steps to performRead the outline of steps to performPractice performing the steps to minimize errorPractice performing the steps to minimize errorChoose record modeChoose record mode

    Context SensitiveContext SensitiveA nalog A nalogLow levelLow level

    RECO RDRECO RDStop, Save test, playbackStop, Save test, playback

  • 8/9/2019 QTP Study.

    21/27

    Edit Test Edit Test

    Insert synchronization pointsInsert synchronization pointsUsed to slow down execution of a test script Used to slow down execution of a test script

    CheckpointsCheckpointsU

    sed toU

    sed to checkcheck expected valueexpected value of a step against theof a step against theactual valueactual value at a specificat a specific pointpoint during executionduring executionInsert output valuesInsert output values

    Used to retrieve values from the AU TUsed to retrieve values from the AU TInsert ParameterizationInsert Parameterization

    A llows you to store data in the data table A llows you to store data in the data tableInclude V B Script codeInclude V B Script code

    Last option. Very powerful.Last option. Very powerful.

  • 8/9/2019 QTP Study.

    22/27

    Synchronization Point Synchronization Point

    Specific timeSpecific timeUses the wait function to pause the test for aUses the wait function to pause the test for aspecific amount of time [in seconds]specific amount of time [in seconds]

    Until an event occursUntil an event occursPauses until a specific property of an object has aPauses until a specific property of an object has aspecific valuespecific value

  • 8/9/2019 QTP Study.

    23/27

    CheckpointsCheckpointsStandardStandard

    Checks multiple properties of a single object Checks multiple properties of a single object Text Text

    Checks part or all the text within an object Checks part or all the text within an object

    Text A reaText A reaChecks part or all the text within a text area object Checks part or all the text within a text area object BitmapBitmap

    Checks the visual layout of an entire object or a portion of the object Checks the visual layout of an entire object or a portion of the object DatabaseDatabase

    Checks data in the databaseChecks data in the databaseA ccessibility A ccessibility

    Checks web content accessibility against W3C accessibility rules for theChecks web content accessibility against W3C accessibility rules for thedisableddisabled

    XMLXML

    Checks files using XML rulesChecks files using XML rules

  • 8/9/2019 QTP Study.

    24/27

    O utput valuesO utput values

    StandardStandardStores a single property of an object in the data tableStores a single property of an object in the data table

    Text Text Stores part or all the text of an object in the data tableStores part or all the text of an object in the data table

    Text A reaText A reaStores the content of a text area in the data tableStores the content of a text area in the data table

    DatabaseDatabaseRetrieves content from a database [using a SQL query] andRetrieves content from a database [using a SQL query] andstores it in the data tablestores it in the data table

    XMLXMLRetrieves content from an XML file and store it in the dataRetrieves content from an XML file and store it in the data

    tabletable

  • 8/9/2019 QTP Study.

    25/27

    Parameterize DataParameterize Data A llows your test to read data from the data table. A llows your test to read data from the data table.The data table is an Excel spreadsheet file editableThe data table is an Excel spreadsheet file editablefrom using Excel or any other application that can edit from using Excel or any other application that can edit

    a .xls document a .xls document The DataTable is encapsulated in QTP in theThe DataTable is encapsulated in QTP in theDataTable object. This object contains a sheet forDataTable object. This object contains a sheet forevery action in the test as well as a globally accessibleevery action in the test as well as a globally accessible

    sheet known as the global sheet sheet known as the global sheet Each sheet in the DataTable contains several columnsEach sheet in the DataTable contains several columnsand rows.and rows.The columns can be renamed by doubleThe columns can be renamed by double- -clicking onclicking on

    the header of the column.the header of the column.

  • 8/9/2019 QTP Study.

    26/27

    VBScript Coding VBScript Coding

    When the tools provided by QTP are not When the tools provided by QTP are not sufficient to test an application, V BScript codingsufficient to test an application, V BScript codingcan be used.can be used.

    VBScript was created as a web programming VBScript was created as a web programminglanguage by Microsoft and licensed by manylanguage by Microsoft and licensed by manycompanies for use in their tools.companies for use in their tools.

  • 8/9/2019 QTP Study.

    27/27

    RecapRecap

    CheckpointsCheckpoints - - checkcheckSynchronization pointsSynchronization points - - wait wait

    O utput valuesO utput values retrieve informationretrieve informationParameterizationParameterization configuration dataconfiguration data

    VBScript VBScript adds programmable logicadds programmable logic