+ All Categories
Home > Documents > 18185232 Programming Concepts in QTP With Some Basic Examples

18185232 Programming Concepts in QTP With Some Basic Examples

Date post: 30-May-2018
Category:
Upload: padmini1985
View: 215 times
Download: 0 times
Share this document with a friend

of 76

Transcript
  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    1/76

    Programming Concepts in QTP

    With some Basic Examples

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    2/76

    Automation Object ModelAutomation Object Model

    Automating QuickTest Operations

    Just as you use QuickTest to automate the testing of your applications, you can use theQuickTest Professional automation object model to automate your QuickTest

    operations. Using the objects, methods, and properties exposed by the QuickTestautomation object model, you can write programs that configure QuickTest options andrun tests or components instead of performing these operations manually using theQuickTest interface.

    Automation programs are especially useful for performing the same tasks multiple timesor on multiple tests or components, or quickly configuring QuickTest according to yourneeds for a particular environment or application.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    3/76

    About Automating QuickTest Operations

    You can use the QuickTest Professional automation object model to write programs thatautomate your QuickTest operations. The QuickTest automation object model providesobjects, methods, and properties that enable you to control QuickTest from anotherapplication.

    What is Automation?

    Automation is a Microsoft technology that makes it possible to access software objectsinside one application from other applications. These objects can be easily created and

    manipulated using a scripting or programming language such as VBScript or VC++.Automation enables you to control the functionality of an application programmatically.

    An object model is a structural representation of software objects (classes) that

    comprise the implementation of a system or application. An object model defines a setof classes and interfaces, together with their properties, methods and events, and theirrelationships

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    4/76

    What is the QuickTest Automation Object Model?

    Essentially all configuration and run functionality provided via the QuickTest interface is insome way represented in the QuickTest automation object model via objects, methods, and

    properties. Although a one-on-one comparison cannot always be made, most dialog boxes inQuickTest have a corresponding automation object, most options in dialog boxes can be setand/or retrieved using the corresponding object property, and most menu commands andother operations have corresponding automation methods.

    You can use the objects, methods, and properties exposed by the QuickTest automationobject model, along with standard programming elements such as loops and conditionalstatements to design your program.

    Automation programs are especially useful for performing the same tasks multiple times oron multiple tests or components, or quickly configuring QuickTest according to your needsfor a particular environment or application.

    For example, you can create and run an automation program from Microsoft Visual Basicthat loads the required add-ins for a test or component, starts QuickTest in visible mode,opens the test or component, configures settings that correspond to those in the Options,Test or Business Component Settings, and Record and Run Settings dialog boxes, runs the

    test or component, and saves the test or component.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    5/76

    Regression Testing &Regression Testing &

    Automation

    Automation

    When Automation is applicable?When Automation is applicable?

    Regression Testing Cycles are long and iterative.Regression Testing Cycles are long and iterative.

    If the application is planned to have multiple releases / buildsIf the application is planned to have multiple releases / builds

    If its a long running application where in small enhancements / Bug FixesIf its a long running application where in small enhancements / Bug Fixeskeeps happeningkeeps happening

    Test Repeatability is requiredTest Repeatability is required

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    6/76

    You can then add a simple loop to your program so that your single program can perform theoperations described above for multiple tests or components.

    You can also create an initialization program that opens QuickTest with specific configurationsettings.You can then instruct all of your testers to open QuickTest using this automation

    program to ensure that all of your testers are always working with the same configuration.

    Deciding When to Use QuickTest Automation Programs

    Like the tests or components you design using QuickTest, creating a useful QuickTestautomation program requires planning, design time, and testing.You must always weigh theinitial investment with the time and human-resource savings you gain from automating

    potentially long or tedious tasks.

    Any QuickTest operation that you must perform many times in a row or must perform on aregular basis is a good candidate for a QuickTest automation program.

    The following are just a few examples of useful QuickTest automation programs:

    Initialization programsYou can write a program thatautomatically starts QuickTest and configures the options and the settings required for

    recording on a specific environment.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    7/76

    Maintaining your tests or components You can write a program that iteratesover your collection of tests and components to accomplish a certain goal. For example:

    yUpdating valuesopening each test or component with the proper add-ins, running it in

    update run mode against an updated application, and saving it in order to update the values

    in all of your tests and components to match the updated values in your application.

    yApplying new options to existing tests or componentsWhen you upgrade to a new

    version of QuickTest, you may find that the new version offers certain options that you want

    to apply to your existing tests and components.You can write a program that opens eachexisting test and component, sets values for the new options, then saves and closes it.

    Calling QuickTest from other applicationsYou can design your ownapplications with options or controls that run QuickTest automation programs. For example,you could create a Web form or simple Windows interface from which a product managercould schedule QuickTest runs, even if the manager is not familiar with QuickTest.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    8/76

    To check through QTP if the process isTo check through QTP if the process is

    running or notr

    unning or not

    We can do this job with a simple VBScript code. This will reduce the duration of work flow toless than 2 seconds and you get the result instantly at the click of a button

    Code:

    Dim AllProcessDim ProcessDim strFoundProcess

    strFoundProcess = FalseSet AllProcess = GetObject("winmgmts:") 'create objectForEach Process In AllProcess.InstancesOf("Win32_process") 'Get all the processes running inyour PC

    If (Instr (Ucase(Process.Name),"TASKMGR.EXE") = 1) Then 'Made all uppercase to removeambiguity. Replace TASKMGR.EXE with your application name in CAPS.

    msgbox "Application is already running!" 'You can replace this with Reporter.ReportEvent

    strFoundProcess = True

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    9/76

    Exit forEnd If

    Next

    If strFoundProcess = False Thenmsgbox "Go ahead!Application is not running" 'You can replace this withReporter.ReportEventEnd If

    Set AllProcess = nothing

    To check whether this is working:

    1) Copy the above code to a notepad and save file as test.vbs on your desktop.

    2) Open the Windows Task Manager[Ctrl-Shift-Esc].

    3) Double click on file created above(test.vbs)

    4)You should get a message "Application is already running!"

    5) Done...Enjoy!

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    10/76

    How to Run QTP from Outside when it isHow to Run QTP from Outside when it is

    already closed and Openings QTPalready closed and Openings QTPScripts at a Schedule TimeScripts at a Schedule Time

    There can be situations when you need to schedule your QTP scripts so that they can runwhen you are not present in front of your PC. I will show you a demo below.

    1) Create a .vbs file to launch QTP with required settings, add-ins etc. This code will openyour QTP and run your script froma specified location when it is actually closed (Pretty cool..)

    Here is a sample vbs code

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    11/76

    Set App = CreateObject("QuickTest.Application")App.LaunchApp.Visible = TrueApp.WindowState = "Maximized" 'Maximize QTP windowApp.ActivateView "ExpertView" 'Display Expert ViewApp.open "C:\Test1", False 'Opens test in editable modeApp.Test.Run 'Runs the testApp.Quit 'Close QTP

    2) ok, for the newbies. Create a sample QTP test and save it as Test1 at the location above.

    Copy the code into notepad and name the file as testing.vbs

    3) Now we will automate the opening of vbs file through Windows Scheduler. Go To Start> Control Panel > Schedule Tasks > Click Add Schedule Tasks Click Next on the screen.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    12/76

    4) Click Browse and and select the .vbs file you just created.You will get this screen

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    13/76

    5) Give a name to the task and select the frequency for performing the given tasks. Forthis demo we will select "One time only"

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    14/76

    6) Select Start Time and Start Date. For this demo, select Start Time as current time+5 minsand Start date as todays date.

    7) Next Screen Enter "UserName", "Password" and "Confirm Password" Click Next and

    you should get this screen.

    8) Click on Finish and yo Man, you're done.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    15/76

    Date Driven Testing Using ExcelSheet,Date Driven Testing Using ExcelSheet,

    Notepad andD

    atatableNotepad andD

    atatableData Driven Testing using notepad

    Set f=CreateObject("Scripting.FileSystemObject")Set f1=f.CreateTextFile("c:\text.txt")

    f1.writeline "aaa bbb"f1.writeline "ccc ddd"

    The above script creates a notepad in C: drive with following contents:aaa bbbccc ddd

    Set f2=f.OpenTextFile("c:\text.txt")While f2.AtEndOfStream true

    f3=f2.readlinex=Split(f3, "")msgbox x(0)msgbox x(1)WEnd

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    16/76

    The above script is used for data driven using notepad directly. Here we are not importingdata to excel sheet. Directly values are retreived from notepad. We are using while loop andreading each line till the end. Split function splits the line where space(" ")occurs. Line isdivided to 2 parts.one before space and other after space. For example we have 1st line innotepad as aaa bbb

    here aaa is 1st part and bbb is 2nd part

    x(0)=aaax(1)=bbb

    all values are read this way using while loop. One point to note here is if any line is empty in

    notepad datadriven testing is stopped before that line. It will not proceed further.so we have togive values without any empty lines in notepad. To make things more clear,

    Suppose u have

    aaa bbbccc ddd

    Datadriven is stopped at aaa and bbb only because next line is empty. Datadriven is stoppedafter 1st line.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    17/76

    Datadriven using dataTable

    This Script gives result by retrieving values from datatable.

    A B5 5667 7

    8 89 9

    In datatable enter test data as shown above. Fill values below "A" and "B"script required for

    DDT(data driven testing)is

    val1=datatable("A",1)

    val2=datatable("B",1)res=cint(val1) +cint(val2)

    msgbox res

    Result will be 10,12,14,16,18.

    datatable("column name",sheetname/id)

    cint is a function which converts string to integer.

    check what will happen if u are not using cint in third step.just replace this res=val1+val2 in place of res=cint(val1) +cint(val2)

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    18/76

    Challenges in Regression TestingChallenges in Regression Testing WhyWhy

    we go forAutomationwe go forAutomationEventually, in any software system, users may defects or we can say bugs in thedeveloped program. Normally, these bugs are fixed, the fixes are then tested, and the updated

    software is released back to the users . However, since the software is so tightly coupled or wecan due to the interconnected nature of software, even the smallest change can wreak

    unpredictable havoc when the implications of that change are not properly understood.

    Any software change, even one that corrects a known defect, can affecta system in an unforeseen manner and potentially cause problems that are worse

    than those that the change was originally trying to address.

    Regression testing is the practice of retesting of a software system that has been

    modified to ensure that no previously-working functions have failed as a result ofdefect reparations or newly added functionality.

    Comprehensive regression testing fully ensures that a software system is functioning as designed.Comprehensive regression testing, however, is rarely feasible, given the time and resourceconstraints placed on the typical software development team.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    19/76

    As a software system expands and evolves, it becomes more and more difficult to test everypiece of functionality. This problem is compounded by the frequency of software builds. In anenvironment where software builds are done on a nightly basis, comprehensive

    regression testing of every build is essentially impossible. Typically, in theseenvironments, the testing of previous functionality is foregone to allow for testing ofnew fixes and new functionality. This leaves open the possibility that the software

    team will release software with undiscovered defects.

    Hence we go for an Automation tool that helps us in addressing these challenges. Through anAutomation tool, we create scripts and which are quite helpful in retesting the original

    system's functionality. Every time we get a new build, we execute the created automationscripts to check the previous working functionality. And the most important benefit of

    automation is that we can execute scripts in an unattended mode means it frees QA persons todo other important tasks while the scripts are running automatically.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    20/76

    Descriptive ProgrammingDescriptive Programming

    Example to Count and Close all Open Bowsers

    Script to get count,names of all open browsers and to close them.

    Set b=Description.Createb("micclass").value="Browser"Set obj=Desktop.ChildObjects(b)msgbox obj.countFor i=0 to obj.count-1

    c=obj(i).getroproperty("name")msgbox(c)obj(i).Close

    Next

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    21/76

    Example for Google search page

    SystemUtil.run "iexplore.exe","http://www.google.com"

    Browser("name:=Google.*").Page("title:=Google.*").WebE

    dit("name:=q").set"Testing"

    Browser("name:=Google.*").Page("title:=Google.*").WebButton("name:=Google Search").Click

    Example to check all Check Boxes in a WebPage

    Usage of Description Object is shown below

    Creates a new, empty description object in which you can add collection of

    properties and values in order to specify the description object in place of a testobject name in a step.

    Set Button=Description.Create()

    Button("type").Value="submit"

    Button("name").Value="Google Search"Button("html tag").Value="INPUT"

    Browser("Google").Page("Google").WebButton(Button).Click

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    22/76

    TO CHECKALL THECHECKBOXES ON A PAGE USING

    CHILDOBJECTS PROPERTY

    Dim obj_check

    Set obj_check=Description.Create

    obj_Check("html tag").value="INPUT"obj_Check("type").value="checkbox"

    Dim allcheckboxesSet allcheckboxes=Browser("Browser").Page("orkut - home").ChildObjects(obj_check)a= allcheckboxes.count()

    msgbox a

    For i=0 to (a-1)allcheckboxes(i).Set "ON"

    Next

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    23/76

    Features of QTP 9.2Features of QTP 9.2

    New to Quick Test Pro 9.2?

    Are you new to HP Quick Test Pro 9.2 (QTP)? Say yes and you are at the right place, at theright time. This article is for newbies who want to start their carrier with QTP or have juststarted with QTP. The article will give you a brief overview of various features of QTP, andsince it is for newbies we wont be going into too much details of every feature.

    What is QTP 9.2?

    * HP Quick Test Pro 9.2 is a functional automation and regression testing tool* QTP provides record and playback of events

    * Uses VBScript as the scripting Language* Provides keyword view and expert view to view test cases.* Latest versions of QTP is 9.5 (launched in mid Jan 2008)

    * Previous version of QTP: 6.5, 8.0, 8.1, 8.2, 9.0, 9.1* QTP was previously owned by Mercury Interactive

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    24/76

    Launching QTP

    When you launch QTP for the first time, Add-in manager window is displayed

    What is Add-in?

    * QTP requires Add-in for recognizing object of a specific environment* By default QTP 9.2 comes with 3 Add-ins: Web, ActiveX and VB* Some of the Add-ins available for QTP 9.2 are

    1. Terminal Emulator (TE)2. .NET

    3. Java4. SAP5. Siebel6. Stingray

    7. VisualAge8. Web Services

    * QTP does not require any Add-in to work on Standard windows application* Add-ins can only be loaded when starting QTP

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    25/76

    Once the selected Add-ins are loaded, QTP window will show up

    Hit the record button to start recording. If you are recording for the first time, the Record andRun Settings dialog box opens.

    What all tabs are shown in above dialog would depend on Add-ins that is loaded. Using above

    dialog we can set on what all application should QTP record on.

    Note: If QTP does not record anything on your application then make sure you have the correctsettings specified in Record and Run Settings

    Keyword view

    The Keyword View enables you to create and view the steps of your test in a keyword-driven,modular, table format. This is the only view where complete Test flow can be viewed.

    Expert View

    In Expert View, QTP displays each operation performed on the application in the form of ascript, comprised of VBScript statements. Complete test flow is not available/visible in thisview.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    26/76

    Test and Run-time Object* QTP works on objects in Application Under Test (AUT) by storing object description* This object description is known as a Test Object* Each Test Object supports predefined sets of Methods and properties* The actual object in the AUT which is identified for a Test Object is called the Run-timeobject.

    * A Test Object can always be present without the AUT* Run-time object can only be present when AUT is up and running

    Object Spy

    Object Spy is a tool that can be used to spy Test and run time object for looking at propertiesand methods supported by object being spied

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    27/76

    Object Identification

    * QTP uses three types of properties when identifying a object

    1. Mandatory Always learn these properties for the object

    2. Assistive Learn in case Mandatory properties are not enough to identify the objectuniquely3. Ordinal identifiers Learn in case both mandatory and assistive properties are not able torecognize the objects correctly

    * Ordinal identifiers are of three types:1. Index index of object (0, 1, 2 )

    2. Location Location of the object on the screen (0, 1, 2 )3. CreationTime Used only for Browser. Launchtime of browser (0, 1, 2 )

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    28/76

    Object Identification Settings

    Launch from menu Tools->Object Identification

    Here we can Add/Remove properties from/to Mandatory and Assistive properties. Objects inapplication represent certain special characteristics which allow QTP to map them QTP Test

    object. For window objects this characteristic is mostly define by regexpwndclass. In caseapplication developers dont use standard class names while creating object QTP wont be ableto identify the object correctly. Below is a checkbox in Search window recognized by QTP asWinObject

    By clicking on the User Defined button on Object identification settings window, we can

    add such objects and map. Once added QTP will now be able to recognize the object correctly.

    Object Hierarchy

    * QTP uses object hierarchy to identify object inside a AUT

    * QTP only adds those objects from hierarchy which are necessary for it to identify the objectlater.* In this case QTP will addBrowser(Google).Page(Google).WebEdit(q).Set test (WebTable object ignored)

    * QTP cannot be configured to record such objects automatically.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    29/76

    Object Repository (OR)

    * QTP works on object in application by storing information about the object in Object

    repository* All objects on which user takes an action while recording are automatically added toobject repository

    * Browser, Google, q are three different objects that would be present in OR forthe below generated statement

    Browser("Browser").Page("Google").WebEdit("q").set Test

    * Copying and pasting code from one script to another script does not work in QTP as

    the OR does not get copied to the new script* There are two types of Object Repositories in QTP:1. Shared OR: Can be used by multiple scripts. A central location to store all objects2. Per-Action OR: Every action has its individual object repository

    Per-Action Object Repository

    * Default repository* Specific to actions (Will be used only for a particular action)* Preferable when application is not dynamic with respect to time* Cannot be reused

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    30/76

    Shared Action repository

    * Can be updated by all actions accessing it

    * Preferable when application is dynamic with respect to time* Used in most automation projects* Needs maintenance and administration

    Action

    * Provides way of grouping code into business logic

    * Are pretty similar to Functions in VBScript* Have their own Data Table and Object Repository (in case of per-action object

    repository)* Supports input and output parameters* Actions are of two types: normal and re-usable

    * Re-usable actions can be called in other Test.* QTP does not allow calling another test within a test* TestFlow represent the top level action. Complete test flow can only be viewed in

    Keyword views

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    31/76

    Inserting Actions

    * There are three ways to insert a Action in a test

    1. Insert Call to New2. Insert Call to Copy3. Insert Call to Existing

    * Insert Call to New - Creates a new action and adds a call to the same. Pfrovide the name"Cancel Ticket" in the "Name" field and click on OK button.* Adds below line to the code

    RunAction "Cancel Ticket", oneIteration

    Actions - Insert Call to Existing

    * Insert Call to Existing User to insert call to a re-usable action located within the same test or

    some other test* This inserts the call to the existing action. In case the action in present in some other test case

    then a read only copy of action is inserted

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    32/76

    Actions Insert Call to Copy

    * Insert Call to Copy - Inserts call to an existing re-usable action and creates an editable

    copy of that action* Actions cannot be deleted from a Test from Expert view. To delete a action one must go tothe keyword view and delete the action

    * An action call cannot be inserted directly by writing code in Expert View, it has to beadded through the GUI first.

    Action Iterations

    An action can be run for 1 or more rows from its Local Data Table.

    * QTP supports there types of iteration modes:1. Run one iteration only2. Run on all rows3. Run from Row to Row

    * Similar to Action, a test can also be run for multiple iterations from Global Data Table

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    33/76

    Why Parameterization?

    * Parameterization allows us to pick different values at run time.

    * Reduces Time and Effort.* Usage of data drivers allows us to use the same data for various input boxes.* Parameterization can also be done for checkpoints.

    Data Table

    * Data Table is excel like spreadsheet which can be user for parameterizing a test case* DataTable are of two types:1. Global Data Table Data table for Test flow

    2. Local data table Data table for every action

    * Data table value can be accessed using the below methoda) DataTable("",dtGlobalSheet)

    b) DataTable("",dtLocalSheet)c)DataTable("","")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    34/76

    Run-time Data table

    * Any changes made to Data table during run-time is stored in run-time data table.* Run-time data table is available in the test results summary of a test* DataTable values can be changed at run-time by using below mentioned code:

    DataTable(OrderConf, dtGlobalSheet) = ABCD1234

    Resources

    * Scripts written in VBScript language can be add as a Resource to the test* All code written in the script is available across all Actions* A VBScript can also be loaded in an Action by using ExecuteFile function. Ex

    ExecuteFile C:\Init.vbs* In case of multiple files QTP combines all the files into a single one and executes thecode. The files are combine in bottom to top order

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    35/76

    Environment Variables

    * Environment variables are global variables available to all Actions* They can be used to run a test case on different environment

    * To add a new Environment variable go to Test -> Settings->Environment (Tab)* Environment variables are of two types

    1. Built-in

    2. User-Defined

    * Built in environment variables give information about the system and the current test* User-defined Environment variables added in the Environment tab of Test Settings are

    Read-only during the test run* Environment variables can be added during runtime also using codeEnvironment.Value(OrderNumber) = ABCDEF* Environment variables can be loaded at run-time from a XML file using the below codeEnvironment.LoadFromFile "C:\TestEnvironment.xml"* The Environment XML file has to be in below format:

    APP_URL

    http://test1.appserver.com

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    36/76

    Parameters

    * Parameters provide another way of parameterizing the test cases

    * There are two types of parameters:1. Test parameters2. Action parameters

    * Test parameters can be set in Test->Settings->Parameters (Tab)* Test parameters value can be provided when replaying the test* Test arguments can be accessed in the test using TestArgs()

    Action Parameters

    * Used to pass parameters to Action

    * Output parameters can only be used when Action is being called for a single iteration* Ex RunAction "Login", oneIteration, "TestUser", "TestPass", out

    * A parameter can be accessed usingParameter("ParamName")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    37/76

    Checkpoints

    * Checkpoints are verification points in a test

    * Test without checkpoint would never have a pass status* Checkpoints can be of types

    Built-in checkpoints

    Custom checkpoints* Types of Built-in checkpoints available are

    1. Standard checkpoints: Verify properties of an object

    2. Text checkpoints: Verify text presence between two strings3. Text Area checkpoint

    4. Bitmap checkpoint5. Accessibility checkpoint6. Database checkpoint7. XML Checkpoint

    * Only Database and XML checkpoints can be inserted in idle mode.* Rest all checkpoints can only be added during Recording or through Active screens.* Checkpoint code

    Browser("Google").Page("Google").WebEdit("q").Check CheckPoint("VerifyTextBox_Standard")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    38/76

    Custom Checkpoints

    * Custom checkpoints can be created using Code

    loginExist = Browser().Page().Link(text:=Login).Exist(0)If loginExist then

    Reporter.ReportEvent micPass, Check Login, Login link existsElseReporter.ReportEvent micFail, Check Login, Login link does not existsEnd if

    * Custom checkpoint can be made flexible based on implementation and are

    preferred over Built-in checkpoints

    Test Results

    Test results provide a execution summary of the complete test case* There are different types of status in test results summary:

    1. Passed2. Failed

    3. Done4. Warning5. Information

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    39/76

    Descriptive Programming

    * Alternate way of writing test cases without having objects in object repository

    * Descriptive programming can be done in two ways

    1. Using object description2. Using string description

    * In DP objects are identified by describing all the identification properties* String description DP

    Browser(title:=Google).Page(title:=Google).WebButton(name:=Search).Click* Object Based DP

    Set btnSearch = Description.Create : btnSearch(name).Value = SearchSet brwGoogle = Description.Create : brwGoogle(title).value = GoogleSet pgGoogle = Description.Create : pgGoogle(title).value = GoogleBrowser(brwGoogle).Page(pgGoogle).WebButton(btnSearch).Click

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    40/76

    Description objects can also be used to get all child objects matching a criterion. Ex

    Set oDesc = Description.CreateoDesc(name).Value = txt_.*

    oDesc(name).RegularExpression = TrueSet allMatchingObjects = Browser().Page().ChildObjects(oDesc)

    Msgbox allMatchingObjects.CountMsgbox allMatchingObjects(0).GetROProperty(name)

    * By default all property values are considered as regular expression patterns* When using string description all regular expression must be used with escape character forliteral meaning. Ex - Link(text:=Logout \(Piyush\)).Click

    * DP based Object repository can be created in any file

    * Code can be copied from one script to another without copying the object repository* Custom implementation of object is easier. Ex

    objStrDesc = Browser(title:=Test).Page(title:=Test).Link(text:=Login)Execute Set obj = & objStrDescobj.Click

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    41/76

    QTP Misc information

    * QTP and the AUT has to be on the same machine

    * QTP can be controlled remotely from another machine* QTP scripts cannot be run without QTP

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    42/76

    QTP and ExcelQTP and Excel Part 1Part 1

    How can we use the data table to provide input data to an application?

    Use the DataTable.Value method to access data from the data table and input it into the

    application

    For data in the Global datasheet

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    43/76

    1. Open a new script.2. In column A of the Global datasheet, enter the data in three rows.

    3. Go to www.google.com.

    4. Begin recording.5. Type a value into the Google search field.6. Stop recording.7. Go to the Expert view. Modify the script so it look like this:

    rc = DataTable.Value ("A", dtGlobalSheet)msgbox rc

    Browser("Google").Page("Google").WebEdit("q").Set rc

    8. To run all rows in the global data table, go to Test ->; Test Settings -> Runtab, and select "Run on all rows."

    For data in the Local datasheet:

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    44/76

    1. Start a new script.2. In column A of the Action1 datasheet, enter the data in three rows:

    3. Go to www.google.com.

    4. Begin recording.5. Type a value into the Google search field.6. Stop recording.7. Go to the Expert view. Modify the script so it look like this:

    rc = DataTable.Value ("A",dtLocalSheet)msgbox rc

    Browser("Google").Page("Google").WebEdit("q").Set rc

    8. To run all rows:

    Right-click on the Action name in the Tree View.

    Go to Action Properites -> Run tab, and select "Run all rows."

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    45/76

    Similarly,How can we use the data table to get output data from an

    application?

    Create an Output Value. The text will be placed in the datatable and can be accessed asneeded.

    1. Once you see the text you want to retrieve, start recording.2. From the Insert menu, select Output Value, then Text Output Value.3. Click on the desired text. The "Text Output Value Properties" window will appear.4. In the window you can verify or set the Before and After text settings.

    5. By default the retrieved value will be added to the Global sheet. You can modify thesettings by selecting Output Textin the combo box, then clicking Modify.

    6. Once satisfied, click OK.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    46/76

    An Output statement will be entered into the script.

    Example:Browser("Browser").Page("Page").Output CheckPoint("Text")

    msgbox DataTable.Value("PageOutput_Text_out", dtGlobalSheet)

    In addition, a column (in the example, PageOutput_Text_out) will be inserted into thedatatable(Remember in the runtime datatable), with the output text.

    ORAnother method to retrieve data during run time is to do just the opposite of what wedid above in the first question above.

    DataTable.Value(ParameterID [, SheetID])=NewValue

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    47/76

    Note:

    The value property is the default property for the DataTable object. As the defaultproperty you do not need to explicitly use .Value.

    DataTable(ParameterID [, SheetID]) = NewValue

    Example:

    ' Add data to the current row of the Global sheetDataTable("VarName", dtGlobalSheet) = "new value" ' Using DataTable by itself

    DataTable.Value("VarName2", dtGlobalSheet) = "new value2" ' Using .Value

    ' Add data to the current row of the Local sheet

    DataTable("VarName", dtLocalSheet) = "new value" ' Using DataTable by itselfDataTable.Value("VarName2", dtLocalSheet) = "new value2" ' Using .Value

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    48/76

    QTP and ExcelQTP and Excel Part 2Part 2

    Introduction ofExternal Data Sheet

    In QTP, we have an option for Data Table which comes very useful when the user wants to

    parameterize his/her test. The parameters set by user appear by default in the Columns of thesheet. Not only is this helpful for parameterized operation of your test also when you want to

    work with the Output function of QTP you can use this table since the corresponding outputs

    can be viewed over here.

    This option can be as per the user requirement and in this the user can make an Excel sheetwith the required parameters in it. Also one can import and export the contents to his test

    while running it.

    Import External Data File

    The user shall perform the following operations:

    In this once the user has created the Excel sheet and has recorded the test, (s)he shall right clickon any of the cells in the Data Table and select the File>Import, user will get a window where

    (s)he will have to select the exact location of the excel sheet.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    49/76

    On Clicking the option, user will get a window pop-up box asking whether you will want toreplace the contents of the current data table with the ones in the excel sheet. Click OK and

    proceed.

    Select the exact location of the excel file on your PC which you want to import.

    The contents of the excel sheet shall appear in the Data Table of QTP once you selected therequired excel sheet.

    Remember to use the same naming convention through-out the script, you have used in thefile. Each of the column name in your excel file will become one parameter.

    Secondly the actions for which the user shall be setting parameters need to be given the samename as in the imported excel file. As shown below, while recording the file the user has

    selected a particular value for the Action which he wants to parameterize which will appear inthe constant option.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    50/76

    The user has to choose the Parameter option and then type the exact name as in the Datatable for e.g.: No_Pass, here we are parameterizing the no of passengers for whom the

    tickets have to be booked and will re-run the script for that much time.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    51/76

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    52/76

    Points to note regarding which location to select OR whether to make a sheet global orlocal.

    1. Globally implies the user has the Global sheet of the data table filled up with certaindata. Now when he runs the test it will operate for the amount of rows that are filled in

    this sheet.

    2. If you want a condition that for single row run of the global sheet there should be run of

    another sheet namely the Action 1 of the data table we call the operation as Local.

    3. In this it is important that the user selects the Parameter option as local and not globalas in the above condition and the required contents will come in Action 1 sheet.

    4. Now initially if while you are importing if there were two sheets created by you then bydefault the contents of the second sheet will be Action 1. It is only that the correspondingAction be parameterized properly.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    53/76

    Now, In the keyword view, Right click on the Action 1 and select Action Call Propertiesand then in the Run Tab select the no of rows for which you want to run the Local sheet.

    When the user runs this script, for every single row of the Global sheet, the Action 1sheet will run for all of its respective columns.

    A similar method can be used to import a single sheet or a database file.

    Also from within the script you can use Datatable.Import("path of file")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    54/76

    Export External Data File

    Like importing data sheet we can also export the entire data table into an externalexcel file. This is basically useful if one wants to use the required parameters insome different test run within QTP.

    Similar to the exporting of complete file we can also export an single sheet fromthe data table

    Also from within the script you can use Datatable.Export("path of file")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    55/76

    QTP Interview questionsQTP Interview questions

    Quick Test Professional: Interview Questions and answers.

    1. What are the features and benefits of Quick Test Pro(QTP)?

    1. Key word driven testing2. Suitable for both client server and web based application

    3. VB script as the script language4. Better error handling mechanism

    5. Excellent data driven testing features

    2. How to handle the exceptions using recovery scenario manager in QTP?

    You can instruct QTP to recover unexpected events or errors that occurred in your testing

    environment during test run. Recovery scenario manager provides a wizard that guides youthrough the defining recovery scenario. Recovery scenario has three steps1. Triggered Events2. Recovery steps

    3. Post Recovery Test-Run

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    56/76

    3. What is the use of Text output value in QTP?

    Output values enable to view the values that the application talks during run time. When

    parameterized, the values change for each iteration. Thus by creating output values, we cancapture the values that the application takes for each run and output them to the data table.

    4. How to use the Object spy in QTP 8.0 version?

    There are two ways to Spy the objects in QTP1) Thru file toolbar: In the File ToolBar click on the last toolbar button (an icon showing a

    person with hat).2) Thru Object repository Dialog: In Object repository dialog click on the button objectspy In the Object spy Dialog click on the button showing hand symbol. The pointer now

    changes in to a hand symbol and we have to point out the object to spy the state of theobject. If at all the object is not visible or window is minimized then hold the Ctrl buttonand activate the required window to and release the Ctrl button.

    5. What is the file extension of the code file and object repository file in QTP?File extension ofPer test object rep: filename.mtrShared Object rep: filename.tsrCode file extension id: script.mts

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    57/76

    6. Explain the concept of object repository and how QTP recognizes objects?

    Object Repository: displays a tree of all objects in the current component or in the currentaction or entire test( depending on the object repository mode you selected).

    we can view or modify the test object description of any test object in the repository or toadd new objects to the repository.Quicktest learns the default property values and determines in which test object class it fits.

    If it is not enough it adds assistive properties, one by one to the description until it hascompiled the unique description. If no assistive properties are available, then it adds a

    special Ordinal identifier such as objects location on the page or in the source code.

    7. What are the properties you would use for identifying a browser and page whenusing descriptive programming?

    name would be another property apart from title that we can use. OR

    We can also use the property micClass.

    ex: Browser(micClass:=browser).page(micClass:=page)

    8. What are the different scripting languages you could use when working with QTP?

    You can write scripts using following languages:Visual Basic (VB), XML, JavaScript, Java, HTML

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    58/76

    9. Tell some commonly used Excel VBA functions.

    Common functions are:Coloring the cell, Auto fit cell, setting navigation from link in one cell to other saving

    10. Explain the keyword createobject with an example.

    Creates and returns a reference to an Automation objectsyntax: CreateObject(servername.typename [, location])

    Argumentsservername:Required. The name of the application providing the object.

    typename : Required. The type or class of the object to create.location : Optional. The name of the network server where the object is to be created.

    11.Explain in brief about the QTP Automation Object Model.

    Essentially all configuration and run functionality provided via the QuickTest interface is in

    some way represented in the QuickTest automation object model via objects, methods, and

    properties. Although a one-on-one comparison cannot always be made, most dialog boxesin QuickTest have a corresponding automation object, most options in dialog boxes can beset and/or retrieved using the corresponding object property, and most menu commands andother operations have corresponding automation methods. You can use the objects,methods, and properties exposed by the QuickTest automation object model, along with

    standard programming elements such as loops and conditional statements to design yourprogram.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    59/76

    12. How to handle dynamic objects in QTP?

    QTP has a unique feature called Smart Object Identification/recognition. QTP generallyidentifies an object by matching its test object and run time object properties. QTP may fail torecognize the dynamic objects whose properties change during run time. Hence it has an

    option of enabling Smart Identification, wherein it can identify the objects even if theirproperties changes during run time.Check out this:

    If QuickTest is unable to find any object that matches the recorded object description, or if itfinds more than one object that fits the description, then QuickTest ignores the recorded

    description, and uses the Smart Identification mechanism to try to identify the object.While the Smart Identification mechanism is more complex, it is more flexible, and thus, ifconfigured logically, a Smart Identification definition can probably help QuickTest identify an

    object, if it is present, even when the recorded description fails.

    The Smart Identification mechanism uses two types of properties:

    Base filter properties - The most fundamental properties of a particular test object class; those

    whose values cannot be changed without changing the essence of the original object. Forexample, if a Web links tag was changed from to any other value, you could no longer call itthe same object. Optional filter properties - Other properties that can help identify objects of a

    particular class as they are unlikely to change on a regular basis, but which can be ignored ifthey are no longer applicable.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    60/76

    13. What is a Run-Time Data Table? Where can I find and view this table?

    In QTP, there is data table used, which is used at runtime.-In QTP, select the option View->Data table.-This is basically an excel file, which is stored in the folder of the test created, its name is

    Default.xls by default.

    14. How does Parameterization and Data-Driving relate to each other in QTP?

    To data driven we have to parameterize. i.e. we have to make the constant value asparameter, so that in each interaction(cycle) it takes a value that is supplied in run-time datatable. Through parameterization only we can drive a transaction (action) with different setsof data.You know running the script with the same set of data several times is not suggested,

    and its also of no use.

    15. What is the difference between Call to Action and Copy Action.?

    Call to Action: The changes made in Call to Action, will be reflected in the original action(from where the script is called). But where as in Copy Action , the changes made in thescript ,will not effect the original script(Action)

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    61/76

    16. Explain the concept of how QTP identifies object.

    During recording qtp looks at the object and stores it as test object. For each test object QT

    learns a set of default properties called mandatory properties, and look at the rest of theobjects to check whether this properties are enough to uniquely identify the object. During

    test run, QTP searches for the run time objects that matches with the test object it learnedwhile recording.

    17. Differentiate the two Object Repository Types of QTP.

    Object repository is used to store all the objects in the application being tested.Types of object repository: Per action and shared repository.In shared repository only one centralized repository for all the tests. where as in per action

    for each test a separate per action repository is created.

    18. What the differences are and best practical application of Object Repository?

    Per Action: ForEach Action, one Object Repository is created.Shared: One Object Repository is used by entire application

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    62/76

    19. Explain what the difference between Shared Repository and Per Action Repository

    Shared Repository: Entire application uses one Object Repository , that similar to GlobalGUI Map file in WinRunnerPer Action: For each Action, one Object Repository is created, like GUI map file per test in

    WinRunner

    20. Have you ever written a compiled module? If yes tell me about some of the functions

    that you wrote.

    Sample answer (You can tell about modules you worked on. If your answer is Yes thenYoushould expect more questions and should be able to explain those modules in laterquestions): I Used the functions for Capturing the dynamic data during runtime. Functionused for Capturing Desktop, browser and pages.

    21. Can you do more than just capture and playback?

    Sample answer (Say Yes only if you worked on): I have done Dynamically capturing theobjects during runtime in which no recording, no playback and no use of repository is doneAT ALL.-It was done by the windows scripting using the DOM(Document Object Model) of thewindows.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    63/76

    22. How to do the scripting. Are there any inbuilt functions in QTP? What is the

    difference between them? How to handle script issues?

    Yes, theres an in-built functionality called Step Generator in Insert->Step->Step Generator-F7, which will generate the scripts as you enter the appropriate steps.

    23. What is the difference between check point and output value?

    An output value is a value captured during the test run and entered in the run-time but to a

    specified location.EX:-Location in Data Table[Global sheet / local sheet]

    24. How many types of Actions are there in QTP?

    There are three kinds of actions:

    Non-reusable action - An action that can be called only in the test with which it is stored, andcan be called only once.

    Reusable action - An action that can be called multiple times by the test with which it is stored(the local test) as well as by other tests.External action - A reusable action stored with another test. External actions are read-only inthe calling test, but you can choose to use a local, editable copy of the Data Table informationfor the external action.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    64/76

    25. I want to open a Notepad window without recording a test and I do not want to use

    System utility Run command as well. How do I do this?

    You can still make the notepad open without using the record or System utility script, just by

    mentioning the path of the notepad ( i.e. where the notepad.exe is stored in the system) in theWindows Applications Tab of the Record and Run Settings window.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    65/76

    Tips for Working on QTPTips for Working on QTP

    1# How to open the Application Browser?

    We can do this with the following code

    Set objIE = CreateObject("InternetExplorer.Application")objIE.visible = True

    objIE.Navigate environment("URL_ENV")

    Here the URL specified in the Enviroment file will be navigated. But if we want to directlyplace the URL in the above mentioned code, replace the third line with the below mentioned

    line:

    objIE.Navigate "www.google.com"

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    66/76

    2# How to check if a parameter exists inside the DataTable or not?

    Use the following code:

    On Error Resume Nextval=DataTable("ParamName",dtGlobalSheet)ifErr.number 0 then'Parameter does not existelse'Parameter exists

    end if

    If no error is there, then Err.number = 0

    3# How to know if my checkpoint passes or not?

    chk_PassFail = Browser(...).Page(...).WebEdit(...).Check (Checkpoint("Check1"))if chk_PassFail thenMsgBox "Check Point passed"

    else MsgBox "Check Point failed"end if

    "if chk_PassFail" means if chk_PassFail="True". In the above mentioned code, aboolean value is returned to the variable chk_PassFail.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    67/76

    4# How can I generate a random number?

    The below mentioned code generates a randomnumber in the range of 100-999

    :RandomNumber (100,999)

    5# My test fails due to checkpoint failing, how can I see the result of my checkpoint

    without affecting my test case to checkpoint failure?

    Reporter.Filter = rfDisableAll 'Disables all the reporting events like Pass or even Fail

    chk_PassFail = Browser(...).Page(...).WebEdit(...).Check (Checkpoint("Check1"))

    Reporter.Filter = rfEnableAll 'Enable all the reporting events like Pass or even Failif chk_PassFail thenMsgBox "Check Point passed"elseMsgBox "Check Point failed"

    end if

    6# What is the difference between an Action and a function?Action is a thing specific to QTP while functions are a generic thing which is a feature ofVB Scripting. Action can have a object repository associated with it while a function

    can't. A function is just lines of code with some/none parameters and a single return valuewhile an action can have more than one output parameters.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    68/76

    7# Where to use function or action?

    Well answer depends on the scenario. If you want to use the OR feature then you have to

    go for Action only. If the functionality is not about any automation script i.e. a function

    like getting a string between to specific characters, now this is something not specific toQTP and can be done on pure VB Script, so this should be done in a function and not anaction. Code specific to QTP can also be put into an function using DP. Decision of usingfunction/action depends on what any one would be comfortable using in a given situation.

    8# When to use a Recovery Scenario and when to us On Error Resume Next?

    Recovery scenarios are used when you cannot predict at what step the error can occur or

    when you know that error won't occur in your QTP script but could occur in the worldoutside QTP, again the example would be "out of paper", as this error is caused by printerdevice driver. "On error resume next" should be used when you know if an error isexpected and dont want to raise it, you may want to have different actions depending upon

    the error that occurred. Use err.number & err.description to get more details about theerror.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    69/76

    9# How to use environment variable?

    A simple definition could be... it is a variable which can be used across the reusable actionsand is not limited to one reusable action. We can use Environment variables like a globalvariables.

    There are two types of environment variables:

    1. User-defined2. Built-inWe can retrieve the value of any environment variable. But we can set the value of only user-

    definedenvironment variables.

    To set the value of a user-defined environment variable:Environment (VariableName) = NewValue

    To retrieve the value of a loaded environment variable:

    CurrValue = Environment (VariableName)

    ExampleThe following example creates a new internal user-defined variable named MyVariable with a

    value of 10, and then retrieves the variable value and stores it in the MyValue variable.

    Environment.Value("MyVariable")=10

    MyValue=Environment.Value("MyVariable")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    70/76

    10# How Should I rename my checkpoint inside QTP 9.0?

    Example:

    Browser("Google").Page("Google").WebEdit("Search").Check CheckPoint("Search")In the above example, the user would like to change the name of the CheckPoint objectfrom "Search" to something which is of our convinience

    Note:

    This functionality is new to QuickTest Professional 9.0.This is not available for QTP

    8.2 and below.

    1. Right-click on the Checkpoint step in the Keyword View or on the Checkpoint object inExpert View.2. Select "Checkpoint Properties" from the pop-up menu.3. In the Name field, enter the new checkpoint name.4. Click . The name of the checkpoint object will be updated within the script.Example:

    Browser("Google").Page("Google").WebE

    dit("Search").Check CheckPoint("Search")

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    71/76

    Note:

    You must use the QuickTest Professional user interface to change the name of the

    checkpoint. If you manually change the name of the checkpoint in the script, QuickTestProfessional will generate an error during replay. The error message will be similar to thefollowing:

    "The "" CheckPoint object was not found in the Object Repository. Check the ObjectRepository to confirm that the object exists or to find the correct name for the object."

    The CheckPoint object is not a visible object within the object repository, so if you

    manually modify the name, you may need to recreate the checkpoint to resolve the error.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    72/76

    11#Does QuickTest Professional support Internet Explorer 7.0?

    QuickTest Professional 9.1

    QuickTest Professional 9.1 supports Microsoft Internet Explorer 7.0 Beta 3. Internet Explorerversion 7.0 is now certified to work and to be tested with QuickTest Professional version 9.1.

    QuickTest Professional 9.0

    QuickTest Professional 9.0 supports Internet Explorer 7.0 Beta 2.QuickTest Professional 8.2 and below

    QuickTest Professional 8.2 and below do not include support for Internet Explorer 7.0.

    Does QuickTest Professional support Firefox?QuickTest Professional 9.1 and 9.2

    QuickTest Professional 9.1 provides replay support for Mozilla Firefox 1.5 and MozillaFirefox 2.0 Alpha 3 (Alpha-level support for Bon Echo 2.0a3).

    Notes:

    QuickTest Professional 9.1 will not record on FireFox. You can record a test on Microsoft

    Internet Explorer and run it on any other supported browser, such as FireFox.

    The .Object property for web objects is not supported in FireFox.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    73/76

    QuickTest Professional 9.0

    QuickTest Professional 9.0 provides replay support for Mozilla FireFox 1.5.

    Notes:

    QuickTest Professional 9.0 will not record on FireFox.You can record a test on Microsoft

    Internet Explorer and run it on any other supported browser, such as FireFox.

    The .Object property for web objects is not supported in FireFox.

    QuickTest Professional 8.2 and below

    QuickTest Professional 8.2 and below do not have support for Firefox.

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    74/76

    12# How to check if a dropdown item contains some values?

    Here we have a dropdown list named Items which contains 3 items :Item1, Item2 and Item3. Wewant to check if Item3 is there in the dropdown or not.

    str_ItemType=Browser("..").Page("..").WebList("lst_itemType").GetROProperty("all items") str_ItemType1=Instr(str_ItemType,"Item4")

    If str_ItemType1=0 Then

    Reporter.ReportEvent 0,"Item Type","Verify that Items dropdown list does not contains Item4"

    Else

    Reporter.ReportEvent 1,"Item Type","Verify that Items dropdown list does not contains Item4"

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    75/76

    13# What is the lservrc file in QTP?

    The lservrc file contains the license codes that have been installed

    The lservrc file contains the license codes that have been installed. Whenever a newlicense is created, the license code is automatically added to this file. The lservrc file is atext file, with no extension.

    File Location:

    1) For a Concurrent (Floating) license installation:

    "#server installation directory#\#language#"

    Example:C:\Program Files\XYZ Technologies\ABC Server\English\lservrc

    2) For a Seat (Stand-alone) license installation:

    #AQT/QTP installation directory#\bin"

    Example:C:\Program Files\Mercury Interactive\QuickTest Professional\Bin\lservrc

  • 8/9/2019 18185232 Programming Concepts in QTP With Some Basic Examples

    76/76

    14# What to do if you are not able to run QTP from quality center?This is for especially for newbies with QTP.Check that you have selected Allow other mercury products to run tests andcomponents from Tools--> Options--> Run Tab.

    15# Does QuickTest Professional support Macintosh operating systems?No, QTP is not expected to run on this OS.


Recommended