Monday, November 24, 2008
How to findout the QTP version you are using scripting
msgbox("Product Version: "&Environment("ProductVer"))
msgbox("Product Directory: "&Environment("ProductDir"))
msgbox("Test Name: "&Environment("TestName"))
msgbox("Test Directory: "&Environment("TestDir"))
Wednesday, October 15, 2008
What is the present version of the VB Script we are using
We can findout the version of vbscript you are using by going through the location
C:\Windows\System32, search for the file vbscript.dll, and right click on it and choose the properties. Move to the version tab.
You can findout the version number.
Wednesday, October 8, 2008
Can a function return dictonary object
Functions can return a dictonary object.
Dim dicObj
Set dicObj = CreateObject("Scripting.Dictionary")
Set obj=getname
MsgBox(obj.item("name"))
Public Function getname()
dicObj.add "name","Uday Kumar"
Set getname=dicObj
End function
Thursday, September 25, 2008
How the Message Boxes Close Automatically
If TimeOut is 0, it behaves just like a normal message box. If TimeOut is greater than 0, the dialog box disappears after the specified number of seconds.
Set wShellObj=createobject("WScript.shell")
wShellObj.popup "Hello Uday, How are you",10,"This is sample" ' Displays like this:
The message box automatically closes after 10 sec.s
Even we can handle the error messages from the error handling mechanism like this:
Set fileSysObj=createobject("Scripting.filesystemobject")
On Error resume next
fileSysObj.opentextfile("c:\uday.txt")
str=Err.description
wShellObj.popup str,3,"This is for file not found"
How can I remove test result files from old tests?
The Test Results Deletion Tool enables you to sort the test results by name, date, size, and so forth, so that you can easily identify the results you want to delete.
You can find this utility in Start > Programs > QuickTest Professional > Tools > Test Results Deletion Tool.
By using this tool, we can choose the test, for which you want to delete all the result folders.
Here we can select the result folders and delete that folders.
How can I configure the report to show only errors by default?
[FilterDialog]
ReportAppDefaultFilter=1 # for error only
ReportAppDefaultFilter=3 # shows all messages (default)
How do I create an action template?
To create an action template, create a text file containing the comments, function calls, and other statements that you want to include in your action template. The text file must be in the structure and format used in the Expert View.
Save the text file as ActionTemplate.mst in your
For Ex:
Here i am adding the following content in the text file.
' You are using QTP 9.0
' The author of the software is Uday
Here it shows how it looks like for every action in the QTP:
Sunday, September 14, 2008
How to use a key combination to send input from keyboard to a application
You can use the below statements:
Dim WshellObjSet
WshellObj=WScript.CreateObject("WScript.Shell")
WshellObj.SendKeys "%+{F1}"
But make sure, whether QTP set context to the application before the these statements.
Saturday, August 23, 2008
How to find out the number of links in a web page
Set fileSysObject=createobject("Scripting.FileSystemObject")
Set linksFileName=fileSysObject.opentextfile("D:\samplelinkfile.txt",2,true)
Set linkDescObj=description.Create
linkDescObj("micclass").value="Link"
Set noOfLinks=browser("Browser").Page("Yahoo! India").ChildObjects(linkDescObj)
For i=0 to noOfLinks.count-1
linkName=noOfLinks(i).getROProperty("name")
linksFileName.writeline(linkName)
Next
linksFileName.close
Set fileSysObject=nothing
Wednesday, August 20, 2008
what is the difference between Automation object model(AOM) and test object model(TOM)?
By using QTP automation object model, we can automate QTP operations.
By using object, methods and properties provided by QTP, we can write programs that can configure QTP operations and settings.
For example, you can create and run an automation program from Microsoft Visual Basic that loads the required add-ins for a test or component, starts QuickTest in visible mode, opens the test, configures settings that correspond to those in the Options, Test Settings, and Record and Run Settings dialog boxes, runs the test, and saves the test.
Test Object Model, is nothing but how QTP identifies the objects in the application.
How to get the class of an object, what mandatory and assistive properties are used during recording the application, how it identifies the objects during run session etc...What is the vb script when the url enter into the browser
Browser Object.navigate "URL"
Ex: Browser("browser").navigate "www.yahoomail.com"
How to capture screen shots when an error occurs?
In QTP8.2, we can choose the run setting:
Test -> settings -> Run tab -> set ON save image of desktop when error occurs checkboxIn QTP 9.2, follow the below navigation:
Tools -> Options -> Run tab -> In the drop down list box "On Error"(default) is selected for "Save step screen capture to results"
And even we can also configure, whether we have to proceed to next step or stop the test execution by following below navigation:
File Menu -> Settings -> Run Tab -> Choose the required action from the "Whenever an error occurs during run session" drop down list box.
Where the text version of script file located in file system?
Ex: D:\QTPSample\SampleTest\Action1\Script.mts
How to call action into a script
If you want to call a new action, follow below navigation
Insert Menu ->Call to New Action -> Give an action name description etc...
If you wish to call a read only copy of an action, use "Call to copy of action" and follow the below navigation for it:
Insert Menu ->Call to copy of action ->Choose the test name and action name
If you wish to call a reusable action, then use "Call to existing action"
Insert Menu ->Call to existing of action ->Choose the test name and action name
If you wish to call a reusable action within your programatically during run-time use
RunAction "ActionName",NoOfIterations,Parameters
If you wish to call a reusable action in another test your programatically during run-time use
RunAction "ActionName[ScriptName]",NoOfIterations,Parameters
How to get line numbers in your editor in expert view?
Follow below navigation:
Tools -> Editor Options -> General tab -> set show line numbers check box
How to Parameterize Object repository in QTP?
For Per-Action OR, we can parameterize in both the global sheet and local action sheets.
To do this, we can select the object in OR, and choose parameter radio button in configure value dialog, and choose global or current action sheet in parameter options.
If the OR is shared OR, here only global sheet option is visible and current action sheet is disabled.
To parameterize the OR follow below navigation:
Open the OR by Tools -> OR or OR button -> Select the object in OR or parent object -> Click parameter radio button -> click on the parameter options button beside the textbox ->select data table in parameter type list box -> choose the data sheet type and choose column name in the sheet
What are the product enhancements in QTP 9.2
Enhanced Object Spy Functionality: You can now use the Object Spy to spy on multiple objects during a single spying session. When you click the pointing hand, QuickTest is hidden, but the Object Spy remains visible. You can hover over different objects in your application and view the methods and properties of each one. When you want to return the focus to QuickTest to view methods and properties of a particular object, you click the object with the pointing hand.
Web Drag and Drop Support: You can now test drag and drop operations in your Web-based application using the new Drag and Drop methods, available for all Web test objects (except the container objects Browser, Page, and Frame).
You can use these methods to drag one Web object onto another Web object, to drag a Web object from one location in a frame to another, or to drag an item within a Web object to another location within that object (drag and pan).
Text Recognition Support for Windows-Based Environments: In recent versions of QuickTest Professional, text-capturing test object methods, reserved object methods, text/text area checkpoints, and text/text area output value steps were not available for objects in Windows-based environments (Standard Windows, Visual Basic, ActiveX, .NET Windows Forms, ActiveX, and Terminal Emulators).
In QuickTest Professional 9.2, you can use the text and text area checkpoint or output value commands to verify or retrieve text in your Windows-based objects. Alternatively, you can use the testobject.GetText (for Terminal Emulator objects), testobject.GetVisibleText, or testobject.GetTextLocation test object methods, or the TextUtil.GetText or TextUtil.GetTextLocation reserved object methods to capture the text you need.
When capturing text for a text/text area checkpoint or output value step, or using one of the above mentioned methods, QuickTest tries to retrieve the text directly from the object. If QuickTest cannot capture the text this way (for example, because the text is part of a picture), it tries to capture the text using a new OCR (optical character recognition) mechanism.
Whenever possible, it is highly recommended to check text from your application window by inserting a standard checkpoint, output value, or GetROProperty method for the object containing the desired text to retrieve the value of it's text (or similar) property.
New Supported Operating Systems and Environments
QuickTest Professional 9.2 has added support for the following operating systems, browsers, and development environments.
Ø Microsoft Windows Vista
Ø Citrix support
Ø VMWare desktop support (QuickTest and the tested application must both be installed on the virtual machine).
Ø Microsoft Internet Explorer 7
Ø Mozilla Firefox 2.0
Ø Netscape Browser 8.1.2
Ø Microsoft Windows Presentation Foundation (supported with the .NET Add-in 9.2)
What are the new features in QTP 9.2
Mercury Screen Recorder: You can instruct QuickTest to save a movie of your entire run session or to capture only the segments surrounding errors or warnings that occur. This can be useful to help you see how your application behaved under test conditions or to debug your test or component.
When you select a step in the test results tree and click the Screen Recorder tab, the right pane of the Test Results window displays the frame in the movie corresponding to the highlighted step in the test results tree.
Once you have a movie stored with your test results, you can export the movie file or attach the movie file to the defects you report to Quality Center. You can also use the Mercury Micro Player if you want to watch a captured movie without opening QuickTest.
You can customize the criteria QuickTest uses to save movies in the Run tab of the Options dialog box.
You can customize the criteria QuickTest uses to save movies by selecting Always, For errors, or For errors and warnings in the Save movies to results list in the Run tab of the Options dialog box.
To configure screen recorder options, follow below navigation:
Dynamic Management of Object Repositories: QuickTest now has a new RepositoriesCollection reserved object that you can use to programmatically manage the set of object repositories that are associated with an action during a run session.
At the beginning of a run session, the RepositoriesCollection object contains the same set of object repository files as the Associated Repository Files tab of the Action Properties dialog box. The operations you perform on the RepositoriesCollection object affect only the run-time copy of the collection.
You can use the RepositoriesCollection object to associate or disassociate shared object repositories with an action during a run session or change the priority order of the objects in the list.
We can associate the object repositories to an action by following below navigation:
Monday, August 11, 2008
Can the class of an object be retrieved using the logical name
However, you may use a unique property of an object to determine the class of the object. Include the unique property in a description object then use the ChildObjects method to capture a collection of the objects which have that description. The GetROProperty method can be used on each object in the collection to get the "micclass" property.
Set oDesc = Description.Create()oDesc( "text").Value = "Cancel"Set child = Dialog("Login").ChildObjects (oDesc)msgbox child(0).GetROProperty("micclass")
Why QTP iterates for rows removed from the Data Table
The DataTable contains four rows with data. The user uses the Delete key to delete the third and fourth rows. On replay, QTP still replays four iterations, even though he expects it to replay only two iterations. Why does this happen? The row was not deleted from the Data Table; only its contents were removed.
Each row in the table represents an iteration of the test script. You can see this in the Data Table. Any rows that are used for iterations have a black bottom grid line (instead of a gray grid line).
The CTRL-X and Delete keys remove the values from the cells in the row, but do not remove the rows (the grid line for the is still black).
If you want to prevent QTP from running an iteration on a row, you need to delete the entire row from the Data Table using the Edit -> Delete option (Ctrl+K). (This restores the bottom grid line from black to gray.)
When are optional steps used?
When running a test or component, if a step in an optional dialog box does not open, QuickTest bypasses this step and continues to run the test. When the run session ends, a message is displayed for the step that failed to open the dialog box, but the step does not cause the test or component to fail.
To set an optional step in the Keyword View, right-click a step and choose Optional Step.You can also add an optional step in the Expert View by adding OptionalStep to the beginning of the VBScript statement. For example:OptionalStep.Browser("Browser").Page("Yahoo! Mail - The best").WebEdit("login").Set "uday"
What are environmental variables in QTP? How to use environmental variables?
QTP supports 3 types of environmental variables:
1. Built-in environmental variables: Variables that represent information about the test and the computer on which the test is run, such as Test path and Operating system. These variables are accessible from all tests, and are designated as read-only.
2. User defined internal environmental variables: variables that you define within the test. These variables are saved with the test and are accessible only within the test in which they were defined. You can create or modify internal, user-defined environment variables for your test.To create User defined internal variables follow below navigation:Test -> settings -> Environmental tab -> Choose “User-defined” in variable type -> click on new button and give name and value.
3. User defined external environmental variables: variables that you predefine in the active external environment variables file. External environment variable values are designated as read-only within the test.To create User defined external variables follow below navigation:Test -> settings -> Environmental tab -> Choose “User-defined” in variable type -> and choose Load variables and values from external file(reloaded each run session) check box ->Enter .xml file which contains the environmental variables.
All the internal user defined environmental variables are displayed with black color, and external environmental variables are displayed in blue color.
The access the value of the environmental variables:temp=Environment.Value("Name")
Deleted a reusable external action from test, but the Action Filter and Local Datasheet still does not reflect the removal from the test.
What property we use to get the tooltip of a link or an Image?
Ex : var1=browser("MSN.com").Page("MSN.com").Image("NFL Sunday: Week 10 //LaDainia").GetROProperty("alt")
How to programmatically load a Shared Object Repository
Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
App.Test.Settings.Resources.ObjectRepositoryPath = "
How can you load External Library files in QTP 8.2?
Choose Test > Settings > Choose Resources tab > Choose + button so select the library file > browse and select the library file > click Ok.
We can load the library files using Scripting:
Use executefile function to load library files.
Example:
executefile "C:\Documents and Settings\ukumar\Desktop\Sample.vbs"
x=10
y=5
result=SumOfTwoNumbers(x,y)
msgbox(result)
'Code in External Library file.
'Public function SumOfTwoNumbers(a,b)
'Dim sum
'sum=a+b
'SumOfTwoNumbers=sum
'End Function
How to check number of items in a WebList at run time.
How to "Turn Off" QTP results after running a Script?
How to supress warnings from the "Test results page"?
How to open any application using scripting?
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 test
E.g : SystemUtil.Run "Notepad.exe"
How will you customize the Active Screen settings in QTP?
The more information saved in the Active Screen, the easier it is to edit the test or component after it is recorded. However, more information saved in the Active Screen adds to the recording time and disk space required. This is especially critical in Visual Basic, ActiveX, and .NET Windows Forms environments.
We can customize the Active Screen setting, by using “Custom Active Screen Capture Settings”.
To do this follow below navigation:
Tools > Options > Active Screen Tab > Click on custom level button > configure as per your needs and click Ok.
Friday, August 8, 2008
What is Smart Identification?
Configuring Smart Identification properties enables you to help QuickTest identify objects in your application, even if some of the properties in the object’s learned description have changed.
If QuickTest is unable to find any object that matches the learned object description, or if it finds more than one object that fits the description, then QuickTest ignores the learned description, and uses the Smart Identification mechanism to try to identify the object.
The Smart Identification mechanism uses two types of properties:
Ø Base Filter Properties.
Ø Optional Filter Properties.
Selecting the Enable Smart Identification check box for a particular test object class instructs QuickTest to learn the property values of all properties specified as the object’s base and/or optional filter properties in the Smart Identification Properties dialog box.
Thursday, August 7, 2008
How to create a folder and delete a folder
Set fileSysObj=createobject("Scripting.FileSystemObject")
On Error resume next
fileSysObj.createfolder(folderPath)
If Err.number<> 0 Then
reporter.ReportEvent micFail,"createfolder","Unable to create the specified folder"
End If
If fileSysObj.folderexists(folderPath) Then
fileSysObj.deletefolder(folderPath)
else
reporter.ReportEvent micFail,"folder delete","The specified folder does not exist"
End If
Friday, July 18, 2008
What is the difference between Wait and Synchronization point?
Local and Global.
For an object there is a Global synch time (20 seconds by default)(Available under File->Settings->Run in QTP 9.0) and additionally we can set individually the synch time for a particular object.
Hence total synch time is = Local + Global synch time.
In wait there is no Global concept and it is local to that object only.
Another key difference is: Suppose we have put a wait for 10 seconds then the application would wait for 10 seconds unconditionally. But say if we put a synch point of 10 secs say for an object to appear(local) and default Global synch time is 20 seconds, then total synch time for that object is 20 + 10 =30 seconds, but in case the object would appear in 15 seconds itself, even though the total synch time was 30 seconds, the script would proceed to the next task.
What property we use to get the tooltip of a link or an Image?
Ex : var1=browser("MSN.com").Page("MSN.com").Image("NFL Sunday: Week 10 //LaDainia").GetROProperty("alt")
How to programmatically load a Shared Object Repository
How can you load External Library files in QTP?
Choose Test > Settings > Choose Resources tab > Choose + button so select the library file > browse and select the library file > click Ok.
We can load the library files using Scripting:
Use executefile function to load library files.
Example:
executefile "C:\Documents and Settings\ukumar\Desktop\Sample.vbs"
x=10
y=5
result=SumOfTwoNumbers(x,y)
msgbox(result)
'Code in External Library file.
'Public function SumOfTwoNumbers(a,b)
'Dim sum
'sum=a+b
'SumOfTwoNumbers=sum
'End Function
How to check number of items in a WebList at run time.
How to "Turn Off" QTP results after running a Script?
Is it possible to use the new text recognition mechanism to capture text that is in another language such as French or Japanese?
To indicate which language dictionaries QTP's text recognition mechanism should use, update the supported language list in the registry.
1. Open the registry editor.
2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QTP\MicTest\OcrEngine.
3. Right-click on the supportedLanguages value, and select "Modify."
4. Set the value data to the language or languages to be supported. Use a comma to separate the languages.
Example:English,German,Spanish,French
Note:Combined hieroglyphic languages (CJK - Chinese, Japanese, or Korean) and non-hieroglyphic languages are not supported. For example: English,Japanese
5. Click
6. Restart QTP.
Is there a way to change the method QTP 9.2 uses for text recognition
QTP 9.2 introduced a new text recognition mechanism. The information provided here applies to QTP 9.2 or higher. This solution is not available for earlier versions of QTP.
1. Open the registry editor. (Windows + Run -> regedit)
2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QTP\MicTest\OcrEngine.
3. Right-click on the mode value, and select "Modify."
4. Set the value data for the mode you want to use:
0 - No OCR. Instructs QTP to use only the Windows API-based mechanism (and not the OCR mechanism) to retrieve text from the object.
1 - Windows API/OCR. Instructs QTP to first try to retrieve text directly from the object using the Windows API-based mechanism. If no text can be retrieved, QTP tries to retrieve text using the OCR mechanism. (Default) (Highly recommended when working with CJK languages.)
2 - OCR/Windows API. Instructs QTP to first try to retrieve text from the object using the OCR mechanism. If no text can be retrieved, then QTP uses its Windows API-based mechanism to retrieve text from the object.
3 - OCR only. Instructs QTP to use only the OCR mechanism (and not the Windows API-based mechanism) to retrieve text from the object. (Required when working with Windows Vista.)
5. Click
6. Restart QTP.
Which add-ins can be used with QTP 9.2
· QTP Java Add-in 9.1
· QTP .NET Add-in 9.2
· QTP Oracle Add-in 8.2
· QTP PeopleSoft Add-in 8.2*
· QTP Add-in 8.2 for SAP Solutions
· QTP Siebel Add-in 8.0*
· QTP Stingray Add-in 8.2
· QTP Terminal Emulator Add-in 8.0*
· QTP VisualAge Smalltalk Add-in 8.2
· QTP Web Services Add-in 9.2
Note:You cannot use any other add-ins or add-in version with QTP 9.2, except for those listed above. The PeopleSoft, Siebel, and Terminal Emulator add-ins require an Add-in Upgrade patch before you can use them with QTP 9.2. You can install Add-in Upgrade patches by running the relevant patch executable from the
Does QTP support Macintosh operating systems?
How to change the default directory that appears when saving a test
2. igate to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QTP\MicTest
3. Find the TestsDirectory value. The value contains the path to the directory you want to be the default test script directory.
4. Edit this value to have your desired path.
a. Right click on TestsDirectory.
b. Choose Modify from the menu.
c. Enter the path into the Value data field.
d. Click OK.
Note:You should not place a "\" at the end of the path.
5. Repeat steps 2 through 4 for the following key: HKEY_CURRENT_USER\Software\Mercury Interactive\QTP\MicTest Note:If the specified directory path does not exist, QTP will open the "My Documents" directory by default.
How to programmatically set the object timeout value
Setting("DefaultTimeout") = Milliseconds
Setting("DefaultTimeout") = 4000
Milliseconds: Maximum time in milliseconds to wait before it is determined that an object cannot be found.
To retrieve the setting:
CurrentSetting = Setting("DefaultTimeout")
We can use the browser navigation time-out by:
Setting("WebTimeout") = Milliseconds
To retrieve the setting:
currentsetting = Setting("WebTimeout")
Tuesday, July 15, 2008
How will you customize the Active Screen settings in QTP?
The Active Screen tab enables you to specify which information QuickTest saves and displays in the Active Screen while recording and running tests.
The more information saved in the Active Screen, the easier it is to edit the test or component after it is recorded. However, more information saved in the Active Screen adds to the recording time and disk space required. This is especially critical in Visual Basic, ActiveX, and .NET Windows Forms environments.
We can customize the Active Screen setting, by using “Custom Active Screen Capture Settings”.
To do this follow below navigation:
General Options:
You can specify the type of compression QuickTest uses for storing captured Active Screen information.
- Simple—Instructs QuickTest to save Active Screen captures in standard uncompressed file formats (for example, .html and .png).
- Compressed—Instructs QuickTest to save Active Screen captures in a compressed (zipped) file format. Using this option saves disk space, but it may affect the time it takes to load images in the Active Screen. This is the default option.
Windows Applications Options:
You can specify which properties are captured for each object in a Windows application when it is captured for the Active Screen.
- Complete—Instructs QuickTest to save all properties of all objects in the application's open window/dialog box in the Active Screen of each step. This option makes it possible for you to insert checkpoints and perform other operations on any object in the window/dialog box, from the Active Screen for any step.
- Partial—(Default). Instructs QuickTest to save all properties of all objects in the application's open window/dialog box in the Active Screen of the first step performed in an application's window, plus all properties of the recorded object in subsequent steps in the same window.
This option makes it possible for you to insert checkpoints and perform other operations on any object displayed in the Active Screen, while conserving recording time and disk space. Note that with this option the Active Screen information may not be fully updated for subsequent steps.
- Minimum—Instructs QuickTest to save properties only for the recorded object and its parent in the Active Screen of each step.
This option enables speedy recording and requires relatively little disk space. However, you can insert checkpoints and perform other operations only on the recorded object and on the window/dialog box itself. You cannot perform operations on the other objects displayed in the Active Screen.
This option allows extremely fast recording and requires only a minimum of disk space. However, you cannot perform post-recording test editing from the Active Screen.
Web Options
You can specify whether QuickTest captures Web pages for the Active Screen.
- Disable Active Screen capture—Disables the screen capture of all steps in the Active Screen. If you do not select this option, you can also delete Active Screen information after you have finished editing your test by selecting Save As, and clearing the Save Active Screen files check box.
How will you do batch testing in QTP?
You can use Test Batch Runner to run several tests in succession. The results for each test are stored in their default location. Using 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.
To enable Test Batch Runner to run tests, you must select Allow other Mercury products to run tests and components in the Run tab of the Options dialog box.
To set up and run a test batch:
To remove a test from the list, select it and click the Remove button or choose Batch > Remove.
What are the file extensions for the following?
QTP Script file extension : .mts
Recovery scenario file extension : .qrs
Shared Object repository file : .tsr
Per Action Object repository file : .mtr
Outline the benefits of using GetROProperty instead creating an Output checkpoint
What is Database Output value?
What is Text and Text-area output values?
You can create a text output value from a text string displayed in a screen. You can define the output value as part of the displayed text, and you can specify the text before and/or after the output text.
You can also output text values from defined text areas.
When you create a text or text area output value, the text-recognition mechanism may not always retrieve the expected text. For this reason, when possible, you should retrieve text from your application window by using a standard output value for the object containing the text you require, using its text (or similar) property.
You can create a text output value while recording or editing your test .
To create a text output value while recording:
What are standard output values?
You can use standard output values to output the property values of most objects. You can use standard output values to output text strings by specifying the text property of the object as an output value.
You can also use standard output values to output the contents of table cells.
You can create standard output values while recording or editing your test .
To create standard output values while recording:
What are the different types of categories in “Output Values”
We can create the following categories of output values:
- Standard Output values
- Text and Text-area output values
- Database output values
What is “Output Value”
An output value is a step in which one or more values are captured at a specific point in your test and stored for the duration of the run session.
You can output the property values of any object. You can also output values from text strings, table cells, databases, and XML documents.
If you select to output a value to an existing parameter, Data Table column, or environment variable, the existing value is overwritten when the output value step runs. When the run session ends, the original value is restored.
When you insert an output value step in your test, it is displayed in the Expert view as:
How you will add Recovery Scenarios to your test?
After you have created recovery scenarios, you can associate one or more scenarios with a test in order to instruct QuickTest to perform the recovery scenario(s) during the run session if a trigger event occurs.
To add a recovery scenario to a test:
Can we prioritize the recovery scenarios?
Where recovery scenarios are saved?
Recovery scenarios are saved in recovery scenario files. A recovery scenario file is a logical collection of recovery scenarios, grouped according to your own specific requirements.
What is Application crash error trigger event in recovery scenario?
What is Test-run error trigger event in recovery scenario?
What is Object state trigger event in recovery scenario?
QuickTest detects a specific test object state and identifies it according to its property values and the property values of all its ancestors. Note that an object is identified only by its property values, and not by its class.
What is pop-up trigger event in recovery scenario?
What are the different trigger types in Recovery Scenario?
QTP have 4 types of triggers in Recovery scenario:
- Pop-Up window
- Object State
- Test Run error
What is the process of creating a recovery scenario?
The Recovery Scenario Wizard contains five main steps:
- defining the trigger event that interrupts the run session
- specifying the recovery operation(s) required to continue
- choosing a post-recovery test run operation
- specifying a name and description for the recovery scenario
How can you create Recovery Scenario?
How the recovery scenarios will work?
When you run a test for which you have defined recovery scenarios and an error occurs, QuickTest looks for the defined trigger event(s) that caused the error. If a trigger event has occurred, QuickTest performs the corresponding recovery and post-recovery operations.
The set of recovery operations is performed for each occurrence of the trigger event criteria. For example, suppose you define a specific object state, and two objects match this state, the set of replay operations is performed two times, once for each object that matches the specified state.
What a recovery scenario consists of?
A recovery scenario consists of:
- Trigger Event—The event that interrupts your run session. For example, a window that may pop up on screen, or a QuickTest run error.
- Recovery Operation(s)—The operation(s) that need to be performed in order to continue running the test. For example, clicking an OK button in a pop-up window, or restarting Microsoft Windows.
What is recovery Scenario?
Tuesday, July 8, 2008
What is entire parent hierarchy option in Virtual Object Wizard?
If you want QuickTest to identify the virtual object in one occurrence only, select entire parent hierarchy. QuickTest identifies the virtual object only if it has the exact parent hierarchy. For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will not recognize it if the hierarchy changes to Browser("X").Page("B").Image("C").
What is parent-only option in Virtual Object Wizard?
We can select how you want QuickTest to identify and map the virtual object.
In the Identify object using box, we have two options:
- Parent-only option
- entire parent hierarchy
Where does these Virtual Objects will be saved?
What is Virtual Object Manager?
What is Virtual Object collection?
What are the steps you follow to identify a virtual object?
We can define a virtual object by:
- Mapping it to a standard class
- Marking its boundaries
- Assigning a parent object
- Specifying a name and collection
How you identify Virtual Objects in your application?
What is Virtual Objects in QTP?
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.
QuickTest does not support virtual objects for analog or low-level recording.
- The Web page or application window must be the same size and in the same position when recording and running tests s as it was when you defined the virtual object.
- You cannot insert any type of checkpoint on a virtual object.
- The virtual object should not overlap other virtual objects in your application or Web page.
- You can define virtual objects only for objects on which you can click or double-click and which record a Click or DblClick step. Otherwise, the virtual object is ignored.
How will you create Synchronization points in QTP?
To insert a synchronization point:
- Begin recording your test or component.
- Display the screen or page in your application that contains the object for which you want to insert a synchronization point.
- Choose Insert > Step > Synchronization Point.
- Click the object in your application for which you want to insert a synchronization point. >Click OK.
- The Add Synchronization Point dialog box opens.
6. The Property name list contains the test object properties associated with the object. Select the property name you want to use for the synchronization point.
7. Enter the property value for which QuickTest should wait before continuing to the next step in the test or component.
8. Enter the synchronization point timeout (in milliseconds) after which QuickTest should continue to the next step, even if the specified property value was not achieved.
9. Click OK. A WaitProperty step is added to your test or component.
Ex: Window("Flight Reservation").WinObject("Update Done").WaitProperty "visible", 1, 10000
You can enter Exist and/or Wait statements to instruct QuickTest to wait for a window to open or an object to appear. Exist statements return a boolean value indicating whether or not an object currently exists. Wait statements instruct QuickTest to wait a specified amount of time before proceeding to the next step. You can combine these statements within a loop to instruct QuickTest to wait until the object exists before continuing with the test or component.
In general, the amount of time QuickTest waits for objects to appear or for a browser to navigate to a specified page is insufficient, you can increase the default object synchronization timeout values for your test, by changing the Object Synchronization Timeout in the Test > Settings > Run tab.
What is synchronization point?
When you run a test or component, your application may not always respond with the same speed. For example, it might take a few seconds:
- for a progress bar to reach 100%
- for a status message to appear
- for a button to become enabled
- for a window or pop-up message to open
What is Object Spy?
Using the Object Spy, you can view the run-time or test object properties and methods 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. It displays the run-time or test object properties and values of the selected object in the Properties tab. It displays the run-time or test object methods associated with the selected object in the Methods tab.
To use Object Spy:
- Choose Tools > Object Spy.
- Alternatively, click the Object Spy button from the Object Repository dialog box.
How to use user defined environmental variables?
Environmental variable is useful to carryon the variable values through diff actions in a single script.
- Choose Test > Settings > Click on Environment Tab.
- Select
in the variable type drop down. - Create a new variable and initialize it with a value. This variable will be the Global variable.
Environment("variable_name").
What is parameterization in QTP?
A parameter is a variable that is assigned a value from an external data source or generator. You can use the parameter feature in QuickTest to enhance your test by parameterizing the values that it uses.
You can parameterize values in steps, checkpoints in your test and values of action parameters.
If you wish to parameterize the same value in several steps in your test , you may want to consider using the Data Driver rather than adding parameters manually.
There are four types of parameters:
Test, action parameters: enable you to use values passed from your test , or values from other actions in your test.
In order to use a value within a specific action, you must pass the value down through the action hierarchy of your test to the required action. You can then use that parameter value to parameterize a step 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, or iteration, QuickTest uses a different value from the Data Table.
Environment variable parameters: enable you to use variable values from other sources during the run session. These may be values you supply, or values that QuickTest generates for you based on conditions and options you choose.
Random number parameters: enable you to insert random numbers as values in your test.
What is run-time data table?
During the run session, QuickTest creates a run-time Data Table—a live version of the Data Table associated with your test.
What is design-time data table?
Can we create test scripts in QTP without using object repository or objects?
Whenever QTP records any action on any object of an application, it adds some description on how to recognize that object to a repository of objects called object repository. QTP cannot take action on an object until unless its object description is in the Object Repository. But descriptive programming provides a way to perform action on objects which are not in Object repository.
Below are some of the situations when Descriptive Programming can be considered useful:
1. The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <
2. When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object.
3. When you don’t want to use object repository at all.
4. Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well.
5. When you want to take action on similar type of object i.e. suppose we have 20 textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a good programming approach.
There are two ways in which descriptive programming can be used
By creating properties collection object for the description.
Dim obj_Desc ‘Not necessary to declare
Set obj_Desc = Description.Create
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt.*”
obj_Desc(“name”).regularexpression= “txt.*”
Browser(“Browser”).Page(“Page”).WebEdit(obj_Desc).set “Test”
By giving the description in form of the string arguments.
What will happen if you split an action and using shared object repository mode?
Monday, July 7, 2008
What will happen to the tests if you rename a shared object repository?
What are the limitations for parameterizing test objects in shared object repository?
When parameterizing using a Data Table parameter:
- You must use the global data sheet. The Current action sheet (local) option in the Data Table Parameter Options dialog box is disabled.
- Your change to the object is saved in the shared object repository, but the corresponding Data Table is saved only with the test in which you are currently working.
- The column name in the global Data Table related to the parameterized object must be the same for every test using the same shared object repository.
What is shared object repository type in QTP?
When you use the shared object repository mode, QuickTest uses the object repository file you specify for all the actions in your test.
If you do not specify a file extension when creating a new object repository file, then QuickTest automatically appends the default extension name for shared object repositories: .tsr
When working in shared object repository mode:
- QuickTest adds new objects to the object repository as you record steps on the object.
- QuickTest uses the existing information and does not add the object to the object repository if you record operations on an object that already exists in the shared object repository (i.e. the object has the same test object description).
- QuickTest uses the same test object from the shared object repository file when you record on the same object in two different actions or in different tests
- QuickTest saves changes to the shared object repository file when you save your open test or when you click Save in the Object Repository dialog box if the shared object repository is not locked and/or opened in read-only mode.
What will happen if you insert a call to action into a test and using per-action object repository mode?
- Only the action itself is copied and not its corresponding object repository.
- The copied action will use the same shared object repository as the test into which it is being copied.
- When you insert copies of actions from tests using a different shared object repository or per-action repository mode, you must ensure that all the objects contained in the action are in the test's shared object repository. If the action uses objects that are not in the shared object repository, the test may fail.
What will happen if you insert a copy of an action and using per-action object repository mode?
When you insert a copy of an action into your test:
- The copied action's action object repository is copied along with the action steps.
- You can edit the object repository of the copied action as you would any other object repository in the test.
What will happen if you split an action and using per-action object repository mode?
When you split an action:
- QuickTest makes a copy of the action object repository.
- The two actions have identical object repositories containing all of the objects that were in the original object repository.
What is per-action object repository type in QTP?
When working in object repository per-action mode:
- QuickTest creates a new (blank) object repository for each action. As you record operations on objects in your application, QuickTest automatically stores the information about those objects in the appropriate action object repository.
- When you create a new action, QuickTest creates another new object repository and again begins adding test objects to the repository as you record.
- When you record on the same object in your application in two different actions, the object is stored as a separate test object in each object repository.