Important Questions in QTP: Filed Under: - Sridhar Lukka at 12:24 PM
Important Questions in QTP: Filed Under: - Sridhar Lukka at 12:24 PM
QTP
Q. Explain QTP testing process? A) The Quick Test testing process consists of 6 main
phases:
1. Create your test plan
Prior to automating there should be a detailed description of the test including the exact
steps to follow, data to be input, and all items to be verified by the test. The verification
information should include both data validations and existence or state verifications of
objects in the application.
2. Recording a session on your application
As you navigate through your application, Quick Test graphically displays each step you
perform in the form of a collapsible icon-based test tree. A step is any user action that
causes or makes a change in your site, such as clicking a link or image, or entering data in
a form.
2. Enhancing your test
o Inserting checkpoints into your test lets you search for a specific value of a page, object
or text string, which helps you identify whether or not your application is functioning
correctly.
NOTE: Checkpoints can be added to a test as you record it or after the fact via the Active
Screen. It is much easier and faster to add the checkpoints during the recording process.
o Broadening the scope of your test by replacing fixed values with parameters lets you
check how your application performs the same operations with multiple sets of data.
o Adding logic and conditional statements to your test enables you to add sophisticated
checks to your test.
3. Debugging your test
If changes were made to the script, you need to debug it to check that it operates smoothly
and without interruption.
4. Running your test on a new version of your application
You run a test to check the behavior of your application. While running, QuickTest connects
to your application and performs each step in your test.
5. Analyzing the test results
You examine the test results to pinpoint defects in your application.
6. Reporting defects
As you encounter failures in the application when analyzing test results, you will create
defect reports in Defect Reporting Tool.
Q. Have you ever written a compiled module? If yes tell me about some of the
functions that you wrote.A. I Used the functions for Capturing the dynamic data during
runtime. Function used for Capturing Desktop, browser and pages.
Q. What projects have you used WinRunner on? Tell me about some of the
challenges that arose and how you handled them.A. pbs :WR fails to identify the
object in gui. If there is a non std window obk wr cannot recognize it ,we use GUI SPY for
that to handle such situation.
Q. Can you do more than just capture and playback? A. I have done Dynamically
capturing the objects during runtime in which no recording, no playback and no use of
repository is done AT ALL.
-It was done by the windows scripting using the DOM (Document Object Model) of the
windows.
Q. How long have you used the product? How long have you used the product?A.
Yes, there’s an in-built functionality called “Step Generator” in Insert->Step->Step
Generator -F7, which will generate the scripts as u enter the appropriate steps.
Q. What is the difference between check point and output value. A. 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]
Q. Discuss QTP Environment.A. Quick Test Pro environment using the graphical interface
and Active Screen technologies – A testing process for creating test scripts, relating manual
test requirements to automated verification features – Data driving to use several sets of
data using one test script.
Q. Explain the concept of how QTP identifies object.A. 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 the objects to check whether
this properties are enough to uniquely identify the object. During test run, QT searches for
the run time objects that matches with the test object it learned while recording.
Q. Differentiate the two Object Repository Types of QTP.A. Object repository is used
to store all the objects in the application being tested.2 types of object repository per action
and shared. 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.
Q. What the differences are and best practical application of each.A. Per Action: For
Each Action, one Object Repository is created.Shared : One Object Repository is used by
entire application
Q. Explain what the difference between Shared Repository and Per Action
RepositoryA. Shared Repository: Entire application uses one Object Repository, that similar
to Global GUI Map file in Win RunnerPer Action: For each Action, one Object Repository is
created, like GUI map file per test in Win Runner
Q. Explain in brief about the QTP Automation Object Model.A. Essentially all
configuration and run functionality provided via the Quick Test interface is in some way
represented in the Quick Test automation object model via objects, methods, and
properties. Although a one-on-one comparison cannot always be made, most dialog boxes
in Quick Test have a corresponding automation object, most options in dialog boxes can be
set and/or retrieved using the corresponding object property, and most menu commands
and other operations have corresponding automation methods. You can use the objects,
methods, and properties exposed by the Quick Test automation object model, along with
standard programming elements such as loops and conditional statements to design your
program.
Q. How to handle dynamic objects in QTP?A. QTP has a unique feature called Smart
Object Identification/recognition. QTP generally identifies an object by matching its test
object and run time object properties. QTP may fail to recognize 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 their properties changes during run time.Check
this out-If Quick Test is unable to find any object that matches the recorded object
description, or if it finds more than one object that fits the description, then Quick Test
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, if configured logically, a Smart Identification definition can probably help
Quick Test identify an object, if it is present, even when the recorded description fails.
Q. What is a Run-Time Data Table? Where can I find and view this table?A. 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.
Q. What is the difference between Call to Action and Copy Action?A. 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 the script ,will not effect
the original script(Action)
Q. Explain the concept of object repository & how QTP recognizes objects?A. Object
Repository: displays a tree of all objects in the current component or in the current action 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 to add new objects to the
repository.Quick test 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 has compiled 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.
Q. What are the properties you would use for identifying a browser & page when
using descriptive programming ?A. “name” would be another property apart from “title”
that we can use. ORWe can also use the property “micClass”.ex:
Browser(“micClass:=browser”).page(“micClass:=page”)….
Q. What are the different scripting languages you could use when working with
QTP ?A. Visual Basic (VB),XML, JavaScript, Java, HTML
Q. Few basic questions on commonly used Excel VBA functions.A. common functions
are:Coloring the cellAuto fit cellsetting navigation from link in one cell to othersaving
Q. Explain the keyword createobject with an example.A. Creates and returns a
reference to an Automation objectsyntax: Create Object (server name. Type name [,
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.
Q. How to handle the exceptions using recovery secnario manager in Qtp?A. You
can instruct QTP to recover unexpected events or errors that occured in your testing
environment during test run. Recovery scenario manager provides a wizard that guides you
through the defining recovery scenario. Recovery scenario has three steps1. Triggered
Events2. Recovery steps3. Post Recovery Test-Run
Q. what is the use of Text output value in Qtp?A. Output values enable to view the
values that the application talkes during run time.When paramaterised, the values change
for each iteration.Thus by creating output values, we can capture the values that the
application takes for each run and output them to the data table.
Q. How to use the Object spy in QTP 8.0 version?A. 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) Tru Object repository Dialog—In Objectrepository dialog
click on the button”object spy…”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 the objectif at all the object is not visible..or window is minimised then Hold
the Ctrl button and activate the required window to and release the Ctrl button.
Q. What is the file extension of the code file & object repository file in QTP?A. File
extension of– Per test object rep :- filename.mtr– Shared Oject rep :- filename.tsrCode file
extension id script.mts
Q. Any limitation to XML Checkpoints?A. Mercury has determined that 1.4MB is the
maximum size of a XML file that QTP 6.5 can handle
Q. How to make arguments optional in a function?A. this is not possible as default VBS
doesn’t support this. Instead you can pass a blank scring and have a default value if
arguments r not required.
Q. What are the Features & Benefits of Quick Test Pro (QTP)..?A. 1. Key word driven
testing 2. Suitable for both client server and web based application 3. Vb script as the
scriot language 4. Better error handling mechanism 5. Excellent data driven testing
features Server object error ‘ASP 0177 : 800401f3′Server.CreateObject
Failed /qtp/qtpfaq25.asp, line 94 800401f3
Q. How to supress warnings from the “Test results page”?Ans : From the Test results
Viewer “Tools > Filters > Warnings”…must be “Unchecked”.
Q. When we try to use test run option “Run from Step”, the browser is not
launching automatically why?A. This is default behaviour.
Q. Does QTP is “Unicode” compatible?A. QTP 6.5 is not but QTP 8.0 is expected to be
Unicode compatible by end of December 2004.
Q. How to “Turn Off” QTP results after running a Script?A. Goto “Tools > Options >
Run Tab” and Deselect “View results when run session ends”. But this supresses only the
result window, but a og will be created and can viewed manulaly which cannot be restricted
from getting created.
Q. How to verify the Cursor focus of a certain field?A. Use “focus” property of
“GetRoProperty” method”
Q. How to handle Run-time errors?A. (a) On Error Resume Next : causes execution to
continue with the statement immediately following the statement that caused the run-time
error, or with the statement immediately following the most recent call out of the procedure
containing the On Error Resume Next statement. This allows execution to continue despite a
run-time error. You can then build the error-handling routine inline within the
procedure.Using “Err” object msgbox “Error no: ” & ” ” & Err.Number & ” ” & Err.description
& ” ” & Err.Source & Err.HelpContext
Q. How to open any application during Scripting?A. SystemUtil , object used to open
and close applications and processes during a run session.(a) A SystemUtil.Run statement is
automatically added to your test when you run an application from the Start menu or the
Run dialog box while recording a testE.g : SystemUtil.Run
“Notepad.exe”SystemUtil.CloseDescendentProcesses ( Closes all the processes opened by
QTP )
Q. Types of properties that Quick Test learns while recording?A. (a) Mandatory (b)
Assistive .In addition to recording the mandatory and assistive properties specified in the
Object Identification dialog box, Quick Test can also record a backup ordinal identifier for
each test object. The ordinal identifier assigns the object a numerical value that indicates its
order relative to other objects with an otherwise identical description (objects that have the
same values for all properties specified in the mandatory and assistive property lists). This
ordered value enables Quick Test to create a unique description when the mandatory and
assistive properties are not sufficient to do so.
Q. Checking Bitmaps:A. You can check an area of a Web page or application as a bitmap.
While creating a test or component, you specify the area you want to check by selecting an
object. You can check an entire object or any area within an object. Quick Test captures the
specified object as a bitmap, and inserts a checkpoint in the test or component. You can
also choose to save only the selected area of the object with your test or component in
order to save disk space.When you run the test or component, Quick Test compares the
object or selected area of the object currently displayed on the Web page or application with
the bitmap stored when the test or component was recorded. If there are differences, Quick
Test captures a bitmap of the actual object and displays it with the expected bitmap in the
details portion of the Test Results window. By comparing the two bitmaps (expected and
actual), you can identify the nature of the discrepancy. For more information on test results
of a checkpoint, see Viewing Checkpoint Results.For example, suppose you have a Web site
that can display a map of a city the user specifies. The map has control keys for zooming.
You can record the new map that is displayed after one click on the control key that zooms
in the map. Using the bitmap checkpoint, you can check that the map zooms in
correctly.You can create bitmap checkpoints for all supported testing environments (as long
as the appropriate add-ins are loaded).Note: The results of bitmap checkpoints may be
affected by factors such as operating system, screen resolution, and color settings.
Q. Text/Text Area Checkpoint .A. In the Text/Text Area Checkpoint Properties dialog
box, you can specify the text to be checked as well as which text is displayed before and
after the checked text. These configuration options are particularly helpful when the text
string you want to check appears several times or when it could change in a predictable way
during run sessions. Note: In Windows-based environments, if there is more than one line
of text selected, the Checkpoint Summary pane displays [complex value] instead of the
selected text string. You can then click Configure to view and manipulate the actual selected
text for the checkpoint. Quick Test automatically displays the Checked Text in red and the
text before and after the Checked Text in blue. For text area checkpoints, only the text
string captured from the defined area is displayed (Text Before and Text After are not
displayed). To designate parts of the captured string as Checked Text and other parts as
Text Before and Text After, click the Configure button. The Configure Text Selection dialog
box opens Checking XML : XML (Extensible Markup Language) is a meta-markup language
for text documents that is endorsed as a standard by the W3C. XML makes the complex
data structures portable between different computer environments/operating systems and
programming languages, facilitating the sharing of data. XML files contain text with simple
tags that describe the data within an XML document. These tags describe the data content,
but not the presentation of the data. Applications that display an XML document or file use
either Cascading Style Sheets (CSS) or XSL Formatting Objects (XSL-FO) to present the
data. You can verify the data content of XML files by inserting XML checkpoints. A few
common uses of XML checkpoints are described below: An XML file can be a static data file
that is accessed in order to retrieve commonly used data for which a quick response time is
needed—for example, country names, zip codes, or area codes. Although this data can
change over time, it is normally quite static. You can use an XML file checkpoint to validate
that the data has not changed from one application release to another.An XML file can
consist of elements with attributes and values (character data). There is a parent and child
relationship between the elements, and elements can have attributes associated with them.
If any part of this structure (including data) changes, your application’s ability to process
the XML file may be affected. Using an XML checkpoint, you can check the content of an
element to make sure that its tags, attributes, and values have not changed.XML files are
often an intermediary that retrieves dynamically changing data from one system. The data
is then accessed by another system using Document Type Definitions (DTD), enabling the
accessing system to read and display the information in the file. You can use an XML
checkpoint and parameterize the captured data values in order to check an XML document
or file whose data changes in a predictable way.XML documents and files often need a well-
defined structure in order to be portable across platforms and development systems. One
way to accomplish this is by developing an XML schema, which describes the structure of
the XML elements and data types. You can use schema validation to check that each item of
content in an XML file adheres to the schema description of the element in which the
content is to be placed.
Q. Object Repositories types, Which & when to use? Deciding Which Object
Repository Mode to Choose To choose the default object repository mode and the
appropriate object repository mode for each test, you need to understand the differences
between the two modes. In general, the object repository per-action mode is easiest
to use when you are creating simple record and run tests, especially under the following
conditions: You have only one, or very few, tests that correspond to a given
application, interface, or set of objects. You do not expect to frequently modify test
object properties. You generally create single-action tests. Conversely, the
shared object repository mode is generally the preferred mode when: You have
several tests that test elements of the same application, interface, or set of objects.
You expect the object properties in your application to change from time to time and/or you
regularly need to update or modify test object properties. You often work with multi-
action tests and regularly use the Insert Copy of Action and Insert Call to Action options.
Q. Can we Script any test case with out having Object repository? or Using Object
Repository is a must?A. No. U can script with out Object repository by knowing the
Window Handlers, spying and recognizing theobjects logical names and properties
available.
Q. 3 differences between QTP & Winrunner?A. (a) QTP is object bases Scripting ( VBS)
where Winrunner is TSL (C based) Scripting. (b) QTP supports “.NET” application
Automation not available in Winrunner (c) QTP has “Active Screen” support which
captures the application, not available in WR. (d) QTP has “Data Table” to store script
values , variables which WR does not have. (e) Using a “point and click” capability you
can easily interface with objects, theirdefinitions and create checkpoints after having
recorded a script – without havingto navigate back to that location in your application like
you have to with WinRunner.This greatly speeds up script development.
Q. How to Import data from a “.xls” file to Data table during Runtime.A.
Datatable.Import “…XLS file name…”DataTable.ImportSheet(FileName, SheetSource,
SheetDest)DataTable.ImportSheet “C:\name.xls” ,1 ,”name”
Q. Syntax for how to call one script from another? and Syntax to call one “Action”
in another? A. RunAction ActionName, [IterationMode , IterationRange , Parameters] Here
the actions becomes reusable on making this call to any Action. IterationRange String Not
always required. Indicates the rows for which action iterations will be performed. Valid only
when the IterationMode is rngIterations. Enter the row range (i.e. “1-7″), or enter rngAll to
run iterations on all rows. If the action called by the RunAction statement includes an
ExitAction statement, the RunAction statement can return the value of the ExitAction’s
RetVal argument.
Q. What is the Diff between Image check-point and Bit map Check point?A. Image
checkpoints enable you to check the properties of a Web image.You can check an area of a
Web page or application as a bitmap. Whilecreating a test or component, you specify the
area you want to check byselecting an object. You can check an entire object or any area
within anobject. QuickTest captures the specified object as a bitmap, and inserts
acheckpoint in the test or component. You can also choose to save only theselected area of
the object with your test or component in order to save disk SpaceFor example, suppose
you have a Web site that can display a map of a citythe user specifies. The map has control
keys for zooming. You can record thenew map that is displayed after one click on the
control key that zooms inthe map. Using the bitmap checkpoint, you can check that the map
zoomsin correctly.You can create bitmap checkpoints for all supported testing
environments(as long as the appropriate add-ins are loaded).Note: The results of bitmap
checkpoints may be affected by factors such asoperating system, screen resolution, and
color settings.
Q. How many ways we can parameterize data in QTP ?A. There are four types of
parameters:Test, action or component parameters enable you to use values passedfrom
your test or component, or values from other actions in your test. Data Table parameters
enable you to create a data-driven test (or action)that runs several times using the data
you supply. In each repetition, oriteration, QuickTest uses a different value from the Data
Table. Environment variable parameters enable you to use variable values fromother
sources during the run session. These may be values you supply, orvalues that QuickTest
generates for you based on conditions and optionsyou choose. Random number parameters
enable you to insert random numbers asvalues in your test or component. For example, to
check how yourapplication handles small and large ticket orders, you can have
QuickTestgenerate a random number and insert it in a number of tickets edit field.
Q. If I give some thousand tests to execute in 2 days what do u do?A. Adhoc testing
is done. It Covers the least basic functionalities to verify that the system is working
fine. Q.what does it mean when a check point is in red color? what do u do?A. A red color
indicates failure. Here we analyze the the cause for failure whether it is a Script Issue or
Envronment Issue or a Application issue. Q. If an application name is changes
frequently i.e while recording it has name “Window1” and then while running its
“Windows2” in this case how does QTP handles? A. QTP handles those situations
using “Regular Expressions”. Q. What is Parameterizing Tests? A. When you test your
application, you may want to check how it performs the same operations with multiple sets
of data. For example, suppose you want to check how your application responds to ten
separate sets of data. You could record ten separate tests, each with its own set of data.
Alternatively, you can create a parameterized test that runs ten times: each time the test
runs, it uses a different set of data.
Q. What is test object model in QTP ? A) The test object model is a large set of object
types or classes that QuickTest
uses to represent the objects in your application. Each test object class has a
list of properties that can uniquely identify objects of that class and a set of
relevant methods that QuickTest can record for it.
A test object is an object that QuickTest creates in the test or component to
represent the actual object in your application. QuickTest stores information
about the object that will help it identify and check the object during the
run session.
A run-time object is the actual object in your Web site or application on
which methods are performed during the run session.
When you perform an operation on your application while recording,
QuickTest:
➤ identifies the QuickTest test object class that represents the object on which
you performed the operation and creates the appropriate test object
➤ reads the current value of the object’s properties in your application and
stores the list of properties and values with the test object
➤ chooses a unique name for the object, generally using the value of one of its
prominent properties
➤ records the operation that you performed on the object using the
appropriate QuickTest test object method
For example, suppose you click on a Find button with the following HTML
source code:
<INPUT TYPE=”submit” NAME=”Find” VALUE=”Find”>
QuickTest identifies the object that you clicked as a WebButton test object.
It creates a WebButton object with the name Find, and records the following
properties and values for the Find WebButton:
It also records that you performed a Click method on the WebButton.
QuickTest displays your step in the Keyword View like this:
QuickTest displays your step in the Expert View like this:
Browser(“Mercury Interactive”).Page(“Mercury Interactive”).WebButton(“Find”).Click
Q. What is Object Spy in QTP?A. Using the Object Spy, you can view the properties of
any object in an open application. You use the Object Spy pointer to point to an object. The
Object Spy displays the selected object’s hierarchy tree and its properties and values in the
Properties tab of the Object Spy dialog box.
Q. IF we use batch testing. the result shown for last action only. in that how can i
get result for every action.A. u can click on the icon in the tree view to view the result of
every action
Q. How the exception handling can be done using QTPA. It can be done Using the
Recovery Scenario Manager which provides a wizard that gudies you through the process of
defining a recovery scenario. FYI.. The wizard could be accessed in QTP> Tools-> Recovery
Scenario Manager …….
Q. How many types of Actions are there in QTP?A. There are three kinds of
actions:non-reusable action—an action that can be called only in the test with which it is
stored, and can 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 in the
calling test, but you can choose to use a local, editable copy of the Data Table information
for the external action.
Q. I want to open a Notepad window without recording a test and I do not want to
use SystemUtil.Run command as well How do I do this?A. U 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 the “Windows
Applications Tab” of the “Record and Run Settings window.
Q. How do you plan test automation? 1. Prepare the automation Test plan 2. Identify
the scenario 3. Record the scenario 4. Enhance the scripts by inserting check points and
Conditional Loops 5. Incorporated Error Handler 6. Debug the script 7. Fix the issue 8.
Rerun the script and report the result.
Q. Explain about the Test Fusion Report of QTP ? A) Once a tester has run a test, a
Test Fusion report displays all aspects of the test run: a high-level results overview, an
expandable Tree View of the test specifying exactly where application failures occurred, the
test data used, application screen shots for every step that highlight any discrepancies, and
detailed explanations of each checkpoint pass and failure. By combining Test Fusion reports
with Quick Test Professional, you can share reports across an entire QA and development
team.
Q. To which environments does QTP supports ? A) Quick Test Professional supports
functional testing of all enterprise environments, including Windows, Web, ..NET, Java/J2EE,
SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and
Web services.
Q.Explain the QTP Tool interface. A) It contains the following key elements: Title bar,
displaying the name of the currently open test Menu bar, displaying menus of Quick Test
commands File toolbar, containing buttons to assist you in managing tests Test toolbar,
containing buttons used while creating and maintaining tests
Debug toolbar, containing buttons used while debugging tests. Note: The Debug toolbar is
not displayed when you open Quick Test for the first time. You can display the Debug
toolbar by choosing View > Toolbars > Debug. Note that this tutorial does not describe
how to debug a test. For additional information, refer to the Quick Test Professional User’s
Guide. Action toolbar, containing buttons and a list of actions, enabling you to view the
details of an individual action or the entire test flow.Note: The Action toolbar is not
displayed when you open Quick Test for the first time. You can display the Action toolbar by
choosing View > Toolbars > Action. If you insert a reusable or external action in a test,
the Action toolbar is displayed automatically. For additional information, refer to the Quick
Test Professional User’s Guide.
Test pane, containing two tabs to view your test-the Tree View and the Expert View Test
Details pane, containing the Active Screen Data Table, containing two tabs, Global and
Action, to assist you in parameterizing your test Debug Viewer pane, containing three tabs
to assist you in debugging your test-Watch Expressions, Variables, and Command. (The
Debug Viewer pane can be opened only when a test run pauses at a breakpoint.) Status
bar, displaying the status of the test
Q. How to configure which add-ins will be loaded when working with Quality
Center?A. Note: From QTP 6.5 version the test is opened with the correct add-ins, the
settings below can be used with older versions.When Quality Center launches Quick Test
Professional to run tests, then by default QTP is loaded with all add-ins which are installed
on the machine. If you want QTP to be loaded with the last add-ins configuration which was
opened on this specific machine you should change the following value in the registry of the
machine which QTP is running on:[HKEY_CURRENT_USER\Software\Mercury
Interactive\Quick Test Professional\MicTest\AddIn
Manager]“SilentModeWithPredefinedAddIns”=dword:0000001
Q. How to open Quality Center connection dialog faster? A. You can launch the
Quality Center connection dialog by double clicking on the right pane of the status bar of
either QuickTest or the Report. Q. How do I use QuickTest together with Quality Center? A.
Quality Center is a powerful test management tool that enables you to manage and control
all phases of software testing. It provides a comprehensive view of the testing process so
you can make strategic decisions about the human and material resources needed to test an
application and repair defects.Quality Center and QuickTest work together to integrate all
aspects of the testing process. In QuickTest, you can create tests and save them in your
Quality Center project database. After a test has been run, the results are viewed and
analyzed in Quality Center.For more information on using Quick Test and Quality Center
together, please refer to the Quick Test User’s Guide.
Q. How Does Run time data (Parameterization) is handled in QTP? A. You can then
enter test data into the Data Table, an integrated spreadsheet with the full functionality of
Excel, to manipulate data sets and create multiple test iterations, without programming, to
expand test case coverage. Data can be typed in or imported from databases, spreadsheets,
or text files.
Q. What is keyword view and Expert view in QTP? A. Quick Test’s Keyword Driven
approach, test automation experts have full access to the underlying test and object
properties, via an integrated scripting and debugging environment that is round-trip
synchronized with the Keyword View.
Advanced testers can view and edit their tests in the Expert View, which reveals the
underlying industry-standard VBScript that Quick Test Professional automatically generates.
Any changes made in the Expert View are automatically synchronized with the Keyword
View.
Q. How to access the HTML tags directly? A. QuickTest provides direct access to the
browser’s Document Object Model (DOM) through which you may access the HTML tags
directly. Access to the DOM is done using the .Object notation. You can find more
information about the DOM on the Microsoft Web Workshop web site.The test below
demonstrates how to iterate over all the tags in the page. The test then outputs the inner-
text of the tags (the text contained between the tags) to the report using the Reporter
object.‘ We need the on error because not all the elements have inner-text
On Error Resume Next
Set Doc = Browser(“CNN Interactive”).Page(“CNN Interactive”).Object
‘ Loop through all the objects in the page
For Each Element In Doc.all
TagName = Element.TagName ‘ Get the tag name
InnerText = Element.innerText ‘ Get the inner text ‘ Write the information to the
report
Reporter.ReportEvent 0, TagName, InnerText
Next
Q. Where can I find a web page’s cookie? A. The cookie used by the browser may by
accessed through the browser’s Document Object Model (DOM). The following example
returns the cookie collection from the browser. You can find more information about the
DOM on the Microsoft Web Workshop web site.Browser(“Flight reservations”).Page(“Flight
reservations”).Object.Cookie
Q. How to change the template test which is used by Quality Center to create new
tests? A. When creating a new test from Quality Center, the test is based on a template
test which is located under “bin/TD2000″ directory under the “Test Director Plugins”
installation.You can replace this test to contain the test template that you wish to be
used.Note that if you change the test to use a Quick Test Professional 6.0 (or later)
template test then this test can not be opened in Astra LoadTest 5.x
Q. How to change the manual template test which is used by Quality Center when
converting manual tests to Quick Test test? A. When you have a manual test defined
in Quality Center and you want to create from it an automatic test, you can control the way
this automatic test will be created.You can edit the ManualTemplate.txt file located under
“bin/TD2000″ directory under “Test Director Plugins” installation to contain the steps which
you want to be generated in the QTP test for each manual step.
Q. How to close Quick Test after <n> runs when running from Quality Center? A.
When running multiple Quick Test Professional tests from Quality Center you can specify
that you want to close QTP after specific amount of tests which are executed.To do so, you
should add to the end of the mic.ini file (located under the bin directory of QTP installation)
the following lines:[RemoteAgent]CloseToolAfterRuns=<number>
Q. How to record on non standard menus? A. In QuickTest Professional 8.0 you can
decide how do you want QuickTest to behave while recording on menus from the UI.
This option is available in the “Advanced Windows Application Options” dialog to be found
under
Tools > Options > Windows Applications > Advanced.More information can be found in the
QuickTest User’s Guide
Q. How to terminate an application that is not responding? A. You can terminated any
standard application while running a script in QuickTest.
If you want to terminate the application, just set this line:SystemUtil.CloseProcessByName
“app.exe”orSystemUtil.CloseProcessByWndTitle “Some Title”
Q. Where can I find information on the IE Document Object Model? A. You can find
more information on the IE DOM in the following links:Document object:
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_document.aspOt
her HTML Objects:
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects.aspGeneral DHTML
reference:
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.aspQ.
How to configure Quick Test to record on Embedded HTML Controls? A. In order to
be able to record context sensitive operations on Embedded HTML Controls (an application
which contains an embedded IE HTML viewer), you will need to set the followingAdd to the
ie_hook section in mic.ini (located under Quick Test bin directory) the following lines:
[ie_hook]myapp.exe=yes (where myapp.exe is the executable name of the application you
want to test)you should change the following setting in the registry:
[HKEY_CURRENT_USER\Software\Mercury Interactive\Quick Test
Professional\MicTest\Hooks\myapp.exe]“bbHook”=dword:00000001
“GetMessageHook”=dword:00000001
“WndProcHook”=dword:00000001
Q. How do I launch a new browser from a test? A: A new browser window (and any
other application) can be launched from within a test by adding the following step to your
test:SystemUtil.Run “iexplore.exe”, “http://www.mercuryinteractive.com“Q.How do I
make the test prompt the user for input while it is running? A. The VBScript
InputBox function allows you to display a dialog box that prompts the user for input and
then continue running the test. You can use the value that was entered by the user later on
in the test. See the VBScript reference manual for more information on the InputBox
function.The following example shows the InputBox function used to prompt the user for the
password.Browser(“Mercury Tours”).Page(“Mercury Tours”).WebEdit(“username”).Set
“administrator”
Passwd = inputbox (“Enter password”, “User Input”)
Browser(“Mercury Tours”).Page(“Mercury Tours”).WebEdit(“password”).Set Passwd
Q. How to remove result files from old tests? You can use the Test Results Deletion
Tool to view a list of all the test results in a specific location in your file system or in a
Quality Center project. You can then delete any test results that you no longer require.The
Test Results Deletion Tool enables you to sort the test results by name, date, size, and
more, so that you can easily identify the results you want to delete.You can find this utility
in the Start Menu > QuickTest Professional > Tools > Test Results Deletion Tool.
Q. How to change the logical name of a Test Object? A. When recording an object
Quick Test Professional uses one of the object’s properties as the logical name for the object
(the name displayed in the Expert View and in the Keyward View modes).You can change
the property that is used to be a different one by specifying which property’s value you want
to use as the logical name for the object.For example in order to use the alt property as the
logical name of an image, run regedit.exe and set the following information:
[HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest
Professional\MicTest\Test Objects\Image]
“tag query name”=”alt“
Q. Changing the Mic.ini file A. Some of QuickTest Professional information is stored in a
text file which is called mic.ini. This file is located under the QuickTest bin directory.
[SectionA]NameA=ValueA To enter the above change to the mic.ini file you should perform
the following:1. Open the mic.ini file located under the QuickTest Professional bin
directory using any standard text editor2. Search for section name (in this case
‘SectionA’). If it does not exists – add it to the end of the file3. If the line (beginning
with the NameA text) exists in the section, then change the value to be ValueAIf the line
does not exist add it to the end of this section (before the next Section begins)
Q. How to change the registry? A. Note: Errors in the correct editing of the registry may
cause severe malfunction to the operating system.
[HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTestProfessional
\MicTest\KeyA]“ValueA”=dword:0000001“ValueB”=”StringValue”In order to enter the above
change to the registry, you should do the following:1. Open regedit (type regedit in the
Start>Run dialog)2. Navigate to the specified path (in this case navigate to
HKEY_CURRENT_USER > Software >…>KeyA)3. If the path does not exists, right click
on the right pane, choose Key and enter the missing key name4. If the value does not
exists, right click on the right pane, choose DWORD value or String value and enter the
missing variable nameRight click on the variable, choose Modify and change the value to the
correct one.
Q.Does Quick Test have any debugging capabilities? In order to debug tests you must
install the Microsoft Script Debugger. If you did not download and installed it while installing
Quick Test, the debugger can be still downloaded from the Microsoft Script Technologies
site. After downloading it, double-click on the self-extracting executable and follow the
instructions on your screen.Once the Script Debugger is installed, an arrow points to the
current step that is being executed in the Tree View and the Expert View. You can then use
the debugger to view local action variables, use the command window, view the objects
properties, and more.More information can be found in the Quick Test User’s Guide.
Q. What command-line arguments can I use when launching Quick Test? A. Please
refer to the Quick Test Command Line utility for more information on how to run Quick Test
using a command line.
Q.I have a Microsoft Access database that contains data I would like to use in my
test. How do I do this? The powerful ‘Expert View’ allows you to access databases using
ADO and ODBC. Below is a sample test that uses the information contained in the Authors
table of a database to search for books written by the author. Dim MyDB
Dim MyEng
Set MyEng = CreateObject(“DAO.DBEngine.35″)
Dim Td
Dim rs ‘ Specify the database to use
Set MyDB = MyEng.OpenDatabase(“BIBLIO.MDB”)
Q.How do I add a manual wait step to my test? A manual wait (think time) can be
added to a Quick Test test using the following command:Call Wait(<time in seconds to
wait>)Q. How the Smart identification mechanism works ?1. A. Quick Test
“forgets” the recorded test object description and creates a new object candidate list
containing the objects (within the object’s parent object) that match all of the properties
defined in the base filter property list.2. From that list of objects, Quick Test filters out
any object that does not match the first property listed in the Optional Filter Properties list.
The remaining objects become the new object candidate list.3. Quick Test evaluates the
new object candidate list: If the new object candidate list still has more than one object,
Quick Test uses the new (smaller) object candidate list to repeat step 2 for the next optional
filter property in the list. If the new object candidate list is empty, Quick Test ignores
this optional filter property, returns to the previous object candidate list, and repeats step 2
for the next optional filter property in the list. If the object candidate list contains
exactly one object, then Quick Test concludes that it has identified the object and performs
the statement containing the object. 4. Quick Test continues the process described in
steps 2 and 3 until it either identifies one object, or runs out of optional filter properties to
use. If, after completing the Smart Identification elimination process, Quick Test still cannot
identify the object, then Quick Test uses the recorded description plus the ordinal identifier
to identify the object.
Q. Can I change the Active Screen page which is shown on every new test?A. This
page can be changed to be any valid HTML page. The page can be located either locally or
on the network.For example, if you want your entire organization to view the same Active
Screen page when they open QTP, you should open the NewTest.inf file located under the
dat\snapshots directory of QTP and set the next line:FileName1=<any full path to an HTML
file>FileName1=\\mercury\public\MainPage.htmlQ. How to create an action template?
You can create a template action script that will be used on every new action that is
created. You can use this, for example, to add a header comments to each action.To create
the template action you should create a text file with the name ActionTemplate.mst and
place it under QTP dat folder.
Q.How to pass parameters when calling actions? A. You can pass information between
actions in several ways:1. Using the new Action Parameters feature in Quick Test
8.02. Putting the variable in the data table and then accessing this data table from the
called action.Defining the variable as an environment variable that can be accessed from the
entire test.
Q.How to configure the report to show only error (by default)? A.You can configure
the report to show only error by default by adding the following section to the QTReport.ini
file (located under QTP bin directory).[FilterDialog]ReportAppDefaultFilter=1 # for error
onlyReportAppDefaultFilter=3 # shows all messages (default)
Q. What is the purpose of Objects spy?A. the Object Spy also enables you to view both
the run-time object methods and the test object methods associated with an object and to
view the syntax for a selected method.
Q. What is the return value of the ‘Quit’ Method? A. The Quit method can return an
optional error code. If the Quit method is the final instruction in your script (and you have
no need to return a non-zero value), you can leave it out, and your script will end normally.
Q. What is the purpose of loading QTP Add-Ins? A. Quick Test add-ins help you to
create and run tests and components on applications in a variety of development
environments. Once you load an add-in, you can record and run tests and components on
applications in the corresponding development environment, similar to the way you do with
any other application. Q. What is Smart Identification mechanism in QTP ? A. When
Quick Test uses the recorded description to identify an object, it searches for an object that
matches every one of the property values in the description. In most cases, this description
is the simplest way to identify the object and unless the main properties of the object
change, this method will work. If Quick Test is unable to find any object that matches the
recorded object description, or if it finds more than one object that fits the description, then
Quick Test ignores the recorded description, and uses the Smart Identification mechanism
to try to identify the object.
Q. What are the properties used by the Smart Identification mechanism?A. 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. For example, if a Web link’s
tag was changed from <A> to any other value, you could no longer call it the 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
if they are no longer applicable.
Q. Can we re-use the user defined Environment variables? A. Yes, You can export
your user-defined environment variables to an external .XML file for use with other tests or
components.
Q. What is Object model ? A. 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 set of classes and interfaces, together with their properties, methods and
events, and their relationships.
Q. Can A user use object repository file for two different tests which Are running
at the same time?? A. Yes you can execute two different scripts using same object
repository at same time. But the second test when on opening will prompt you a message
saying that the OR has been locked, but you can run in read only mode.
Q. How do you comment your script? A. By using single quote (‘) before starting of the
line QTP does not support multiple line comments
Q. How do you handle pop-up exceptions? A. By using Recovery Scenario manager or
by using IF Browser (“…”)……………).Exists Then<Statements to process>……….
Q.What are batch tests and how do you create and run batch tests?A. You can use
Test Batch Runner to run several tests in succession. The results for each test are stored in
their default location.Choose Programs > QuickTest Professional > Tools > Test Batch
Runner from the Start menu. The Test Batch Runner dialog box opensUsing Test Batch
Runner, you can set up a list of tests and save the list as an .mtb file, so that you can easily
run the same batch of tests again, at another time. You can also choose to include or
exclude a test in your batch list from running during a batch run.
Q.How do you store and view batch test results?A.When you are ready to run your test
batch, click the Run button or choose Batch > Run. If QuickTest is not already open, it
opens and the tests run sequence begins. Once the batch run is complete, you can view the
results for each test in its default test results folder (<test folder>\res#\report).
Q.What are the virtual objects and how do you learn them? A. Your application may
contain objects that behave like standard objects but are not recognized by QuickTest. You
can define these objects as virtual objects and map them to standard classes, such as a
button or a check box.
Q.How to record the function Key Strokes? A By using SendKeys method For Ex: Set
WshShell = CreateObject (“WScript.Shell”) WshShell.SendKeys “{F1}”
Q.What are Environment variable? A. Environment Variables are two types 1.
Built-in 2. User-defined Internal 3. User-defined external
Built-in variables—- that enable you to use current information about the test and
the QuickTest computer running your test. These can include the test name, the test
path, the operating system type and version, and the local host name.
User-defined internal—variables that you define within the test. They are saved
with the test or component and accessible only within the test or component in which
they were defined.
Q.What is the diff between SystemUtil.Run and Invoke ?A. you should use a
SystemUtil.Run statement to run applications or to open filesin their default applications.
InvokeApplication statement is used to open the executable files and which is supported
primarily for backward compatibility.
Q.How can I improve the working speed of QuickTest ?A. You can improve the
working speed of QuickTest by doing any of the following:· Do not load unnecessary add-
ins in the Add-in Manager when QuickTest starts· Run your tests in “Fast mode.” From the
Run tab in the Options dialog box, select the Fast Option· If you are not using the Active
Screen while editing your test, hide the Active Screen while editing your test to improve
editing response time.· Decide if and how much information you want to capture and save
in the Active ScreenDecide when you want to capture and save images of the application for
the test results.
Q. What was the new features available in QTP 8.2? A. * New Keyword View
* Updated Keyword View steps * New comment field row * New Documentation
Only view * Multiple application areas * New Local parameter type * New
Function Definition Generator
Q.Can we merge two Object Repository files into one file ? 1. Yes, by using QTP
Plus Install QTP Plus and go to Start > Quick Test Plus > Utilities > Repositories
Merge utility
Q.What is the Extensions of Script, Repositories Files ? 1. Script —— .mts Action
based Object Repositories —-.mtr Shared Object Repository ——-.tsr
Q.How do you automate the Quick Test settings ?A.Open Test > Settings and before
setting up the settings click on “Generate Script” button and save that script and every time
before opening the QTP execute the saved Script.
Q. Explain about Update Run in QTP ?A. Test > Update .When you update a test or
component, Quick Test runs through the test or component to update the test object
descriptions, the expected checkpoint values, and/or the Active Screen images and values.
After you save the test or component, the updated data is used for subsequent runs.
Q: Several QTP scripts may be called in a BPT test. Each one may have different
data in a data table. How can the BA in BPT override and control data tables ? A:
The data table is not used when working in BPT. Providing data for these runs should be
done only through Quality Center in an interface easily accessible by a BA. A business
component is a mini QTP test which has its own data table. Business Process Testing does
not have control of data tables used by business components. It controls what Business
Components are, how input/output parameters can be passed among the Business
Components, and the order of the components. Currently there is no way from QC side to
control it
Q:Can users who prefer descriptive programming in QTP have the ability to
SaveAs Descriptive? If this is chosen, the OR values could be saved in the script
instead of the logical values. A: No, this functionality is not available. Q: Will QTP/BPT
work with descriptive programming or only through the object repository?
A:QTP/BPT will work also with descriptive programming, but if you want to utilize the
Keyword View for objects (not only operations) you must use an Object Repository.
Q: Quick Test Professional with SAP. External Support with Quality Center.
Worried about future support. A: SAP is one of our most strategic environments and we
are committed to supporting it. Quick Test Professional SAP add-in 8.2 supports the latest
SAP environments, including SAP GUI 6.40 and Enterprise Portal 6. It should be available
early next year.If the question is referring to QTSAP integration with TD/QC. We will
continue to support this integration with QC. Quick Test Professional with the SAP add-in will
work with QC as it does for all add-insQ:Upgrade of Test Director from 7.x to 8.0;
Discuss best approaches and complications and pitfalls and benefits from the
upgrade also things to watch out for… A:We have a “Best Practices” document in the
KB about upgrading to TD 8.0. CSO website – Download section or KB, you can search for
“Best Practices”
Q: We are using Load runner 7.8 FP1.In that we have load distribution graph,
response time Vs transactions per sec (rounded to nearest sec). We are running
tests on j2ee application where expected response times are in milli seconds (ex
150 millisecond per method). Because rounding to sec we are seeing all
transactions below 1 sec. Is it possible to change response time scale as we
needed in to milli seconds? We would like to see response time distribution
respective to transactions per sec for whole scenario. Which is going to show us if
there any spikes in response times?A: Today, the Analysis UI reports in seconds, even
though the raw data is available in milliseconds. We have taken both of these as
enhancement requests for future releases.
Q:I am running an endurance test on the client using QTP. The test is set to run
500 times. Is there a way to set a counter on the number of times the script
actually ran when it quits before the 500? A: DataTable.GetCurrentRow holds the
current iteration. When QTP quits, it can write this value to the report.
You can use environment variables or a regular variable to keep track of the number of
times to run the script. You can then write this value to the runtime data table. When the
script quits, go to the runtime data table and look at the value. If the script is based on
iterations, then you can use the built-in environment variable “ActionIteration” or
“TestIteration” which will give you the current iterations for either the test or the specific
action.
Q: What are the differences between QTP 8.0 and Quality Center 8.0 vs. QTP 8.2
and Quality Center 8.2? A: We have created a product alert that describes what’s new in
Quality Center and QTP 8.2. You can find the alert on the CSO website. In addition, Mercury
will host a customer webinar on December 13th on Quality Center 8.2. Please see the CSO
website for registration. We will also make the recording of the webinar available on the
CSO website for subsequent viewing.
Q: How are checkpoint baseline values and the purpose of the checkpoint
communicated back to the BA in BPT ? A: The idea is to provide these as custom
keywords. The QTP engineer should create “verification” keywords (functions) and the BA
will use them in QA while defining the component steps. These functions can be defined
either using the standard checkpoint mechanism QTP provides, or any other mechanism the
QTP experts builds. A checkpoint contains a number of properties / values and we use these
properties / values to do the comparison at runtime. We then write the status of the
checkpoint back to the QTP Report. If the report is stored in QC then it’s written to QC; if
the report is stored on the file system then it’s written to the file system.
Q:I am trying to run tests from command line using QTPlaunch.exe with close
option after executing the test. In my driver script execution it will set results file
folder and other settings. Once the test is scheduled at the end it will ask for save
option, this causes manual interference to accept yes or no. We need to fix this in
order to execute the test unattended fashion using QTP command line
utilities. A: We suggest you try restoring the default settings at the end of the
test run to alleviate the problem. Note that in general, we recommend that using the
command line option for automation be dropped in favor of using the QTP Automation API.
If these suggestions do not resolve your issues, please do not hesitate to contact CSO for
further assistance.
Q: We are trying to run TD 8 through Citrix. First, we get a user login error
message when it first displays but we can move past that and login. Then all of the
colors are off – not correct and the graphics are bad. What can we do? A: Citrix is
not an officially supported environment at this time, although we are aware of many
customers who are successfully using Test Director in a Citrix environment. It is possible
that one of these customers can give you some insight into the issues you are experiencing
and provide some suggestions. The best place to interact with other customers is through
the forums on the CSO website. We are investigating the possibility of adding support for
Citrix in the near future. Please check for news and alerts on the CSO website.
Q: What plans are there to improve WinRunner’s and LoadRunner’s “behavior”
with Oracle Apps 11.5.9? Currently I cannot upgrade to WR 7.6 because the
synchronization doesn’t work [with Oracle 11.5.9] and I already have 2 patches
(one custom, and another on the way) to try to make LR 7.8 FP1 work with
11.5.9.A: WinRunner 7.6 indeed had some synchronization issues with WR 7.6 Oracle Add-
In and Oracle Apps 11.5.9. These issues were resolved with WR76JP11 (Fixes
synchronization mechanism and several other minor issues).
Q:I have a user interface in the application which has windows with the same
labels. So when I make a recovery scenario, how do I distinguish the one with the
labels and the one without as I do not want the recovery scenarios to be called on
the wrong one? A: When defining the identification criteria in the pop-up
trigger, you can also use the text within the window (or a substring from it) on top of the
window title, as the differentiator between the windows.
Q: Can it be confirmed that Quality Center works with Microsoft SQL Server? A:
Yes, Quality Center supports MS SQL server 2000 Enterprise edition.
Q: What is the best approach for migrating both test cases and defect entries from
the home-grown application to Quality Center? A:We recommend you use
the Word / Excel add-in and import the data into Quality Center.
Q: We’re using QTP v8.0 and capturing GUI with formatted numeric fields such as
currency, etc. with commas and decimal. QTP does not capture the input (so that I
can parameterize this later), but captures the formatted field after entry. How do I
make QTP capture my input instead of the formatted field? How do I validate this
formatted field that it contains valid input? A:1. If your numeric fields are edit boxes
and QTP record commands like WinEdit.Set “1,234.56″ Then just replace Set command with
Type command like WinEdit.Type “1234.56″ 2. In order to check the numeric value of the
formatted field use VBS functions to convert from strings to numbers. For example:text =
WinEdit.GetROProperty(“text”) ‘ returns string “1,234.56″num = CDbl(text) ‘ returns
number 1234.56num1 = CInt(text) ‘ returns integer number 1235 More information is
needed about this issue. But it sounds like a Data Table formatting issue where the text is
being captured in one format but it shows up in QTP’s data table in another format
Q: One of the biggest highlights of the conference has been the concept of
employing the BTO strategy while utilizing outsourced resources. How is Quality
Center going to handle application security since these different resources may
not exist on a common intranet? A: Since Quality Center utilizes HTTP
communication through port 80, it works for both intranet and the internet environments.
You are correct that outsourcing adds new security requirements. In addition, Mercury
offers Quality Center as a managed service, which has further security requirements. For
Quality Center 8.2, we have added support for Secure LDAP. And we will continue to
enhance the security capabilities of Quality Center in upcoming releases. We will implement
our electronic signature solution for Quality Center, add a more flexible security group
structure, and improve integrations with existing security and identity management
infrastructure.
Comments (1)
3. ChildObjects: Returns the collection of child objects contained within the object.
Syntax: object.ChildObjects (pDescription)
Example:
‘The following example uses the ChildObjects method to retrieve a
’set of child objects matching the description listed in the function
‘call and uses the method to display a message indicating how many
‘objects are found with the specified description: none, one (unique),
‘or several (not unique).
Public Function CheckObjectDesription(parent, descr)
Dim oDesc
‘ Create description object
Set oDesc = Description.Create()
arProps = Split(descr, “,”)
For i = 0 To UBound(arProps)
arProp = Split(arProps(i), “:=”)
If UBound(arProp) = 1 Then
PropName = Trim(arProp(0))
PropValue = arProp(1)
oDesc(PropName).Value = PropValue
End If
Next
‘ Get all child objects with the given description
Set children = parent.ChildObjects(oDesc)
If children.Count = 1 Then
CheckObjectDesription = “Object Unique”
ElseIf children.Count = 0 Then
CheckObjectDesription = “Object Not Found”
Else
CheckObjectDesription = “Object Not Unique”
End If
End Function
10. GetRoProperty: Returns the current value of the test object property from the object in the application.
Syntax: object.GetROProperty (Property, [PropData])
Example:
Sub GetROProperty_Example()
‘The following example uses the GetROProperty method to retrieve the
‘x coordinate of the Test window.
x = Window(“Test”).GetROProperty(“x”)
y = Window(“Test”).GetROProperty(“y”)
End Sub
11. GetTextLocation: Checks whether the specified text string is contained in the specified window area.
Syntax: object.GetTextLocation (TextToFind, Left, Top, Right, Bottom, [MatchWholeWordOnly])
Example:
Sub GetTextLocation_Example()
‘The following example uses the GetTextLocation method to retrieve
‘all of the text within the object.
l = -1
t = -1
r = -1
b = -1
result = Dialog(“Dialog”).WinObject(“Date”).GetTextLocation(“2002″, l, t, r, b)
If result Then
MsgBox “Text found. Coordinates:” & l & “,” & t & “,” & r & “,” & b
End If
End Sub
12. GetToProperties: Returns the collection of properties and values used to identify the object.
Syntax: object.GetTOProperties
Example:
Sub GetTOProperties_Example1()
‘The following example uses the GetTOProperties method to retrieve the
‘list of properties and values used to identify the Internet Options
‘dialog box.
IEOptsDialog = Browser(“Mercury Tours”).Dialog(“Internet Options”).GetTOProperties()
End Sub
13. GetToProperty: Returns the value of a specified property from the test object description.
Syntax: object.GetTOProperty (Property)
Example:
Sub GetTOProperty_Example()
‘The following example uses the GetTOProperty method to retrieve the
‘RegExpWndClass property from the Object Repository.
Dim ObjectName
RegExpWndClass = Window(“Test”).GetTOProperty(“RegExpWndClass”)
End Sub
15. MouseMove: Moves the mouse pointer to the designated position inside the activeXobject.
Syntax: object.MouseMove X, Y
Example:
Sub MouseMove_Example()
‘The following example uses the MouseMove method to move the mouse
‘pointer to the position (20, 30) inside the Advanced object.
Browser(“MyPage”).Dialog(“Settings”).WinObject(“Advanced”).MouseMove 20, 30
End Sub
16. Move: Moves the dialog box to the specified absolute location on the screen.
Syntax: object.Move X, Y
Example:
Sub Move_Example()
‘The following example uses the Move method to move the Internet
‘Options dialog box to the specified location.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Move 659, 35
End Sub
17. Maximize: Maximize the dialog box to fill the entire screen.
Syntax: object.Maximize
Example:
Sub Maximize_Example()
‘The following example uses the Maximize method to maximize the
‘Internet Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Maximize
End Sub
21. SetToProperty: Sets the value of the specified property in its test object description.
Syntax: object.SetTOProperty Property, Val
Example:
Sub SetTOProperty_Example()
‘The following example uses the SetTOProperty method to set the
‘index of a window’s description.
Window(“Test”).SetTOProperty “Index”, 2
End Sub
23. WaitProperty: Waits until the specified object property achieves the specified value or exceeds the specified
timeout before continuing to the next step.
Syntax: object.WaitProperty (PropertyName, PropertyValue, [lTimeOut])
Example:
Sub WaitProperty_Example()
‘The following example uses the WaitProperty method to make the
‘program wait for the “Test” window to become active or for 3 seconds
‘(3 milliseconds) to pass, whichever comes first.
y = Window(“Test”).WaitProperty(“focused”, True, 3000)
End Sub
24. Output: Retrieves the current value of an item and stores it in a specified location.
Syntax: object.Output pVerify
Example:
Sub Output_Example()
‘The following example uses the Output method to output text into the
‘”You can change” Data Table column.
Browser(“index”).Dialog(“Internet Options”).Static(“You can change”).Output CheckPoint(“You can change”)
End Sub
QTP COMBO BOX PROPERTIES
1. GetContent: Returns a string containing the names of all of the items in the combo box.
Syntax: object.GetContent
Example:
Sub GetContent_Example ()