Worksheet API... Set xlApp=Createobject("Excel.Application") set xlWorkBook=xlApp.workbooks.add set xlWorkSheet=xlWorkBook.WorkSheets.add 'Every where on net it is given .WorkSheet instead of .WorkSheets and failing ... take care ' Action we can perform on Worksheet like ...Few this you we can do xlWorkSheet.Range("A1:B10").interior.colorindex = 34 'Color outputWkbook.SaveAs testData,,pwd,writeresPwd 'Save outputWkbook.Close 'Used Range and FInd With objSheet.UsedRange ‘ select the used range in particular sheet Set c = .Find (“nn”)’ data to find For each c in objSheet.UsedRange’ Loop through the used range If c=”nn” then’ compare with the expected data c.Interior.ColorIndex = 40′ make the gary color if it finds the data End If Set c = .FindNext(c)’ next search 'Copy objWorkbook1.Worksheets(“Sheet1″).UsedRange.Copy 'Counting rowsCount=xlWorkSheet.Evaluate("COUNTA(A:A)") 'Will count the # of rows which have non blank value in the column A Worksheets (Worksheet) | |
Names (Name) Range Areas Borders (Border) Errors Error Font Interior Characters Font Name Style Borders (Border) Font Interior FormatConditions (FormatCondition) Hyperlinks (Hyperlink) Validation Comment Phonetics (Phonetic) Shapes (Shape) SmartTags SmartTag CustomProperties CustomProperty SmartTagActions SmartTagAction Protection AllowEditRanges AllowEditRange UserAccessList UserAccess | Comments (Comment) CustomProperties CustomProperty HPageBreaks (HPageBreak) VPageBreaks (VPageBreak) Hyperlinks (Hyperlink) Scenarios (Scenario) OLEObjects (OLEObject) Outline PageSetup Graphic QueryTables (QueryTable) Parameters (Parameter) PivotTables (PivotTable) CalculatedFields CalculatedMembers CalculatedMember CubeFields CubeField TreeviewControl PivotCache PivotFields PivotFormulas (PivotFormula) PivotItems (PivotItem) CubeFields (CubeField) OLEObjects (OLEObject) ChartObjects (ChartObject) Chart PivotLayout AutoFilter Filters (Filter) Tab |
Friday
QTP - Excel Worksheet Object Model
Monday
QTP - Setting.WebPackage("ReplayType") = 2
reference:
http://www.advancedqtp.com/forums/index.php/topic,584.0.html
Try to run with mouse events, instead of browser events.
Code
GeSHi (qtp):
Setting.WebPackage("ReplayType") = 2 'Mouse events (browser events = 1)
Created by GeSHI 1.0.7.20
I would like to elaborate on Meir's answer, by default QTP communicates with browser objects via DOM events this means that:
Browser().Page().WebElement().Click
Is equivalent to:
Browser().Page().WebElement().Object.Click
If the web application listens to other events they will not be produced. When using device replay QTP physically moves the mouse cursor and simulates a click so it's much closer emulating a user action. I would recommend localizing this change to a function library.
Code
GeSHi (qtp):
Public Function DeviceClick(test_object)
replayType =Setting.WebPackage("ReplayType")' save old state
Setting.WebPackage("ReplayType") = 2
test_object.Click
Setting.WebPackage("ReplayType") = replayType
End Function
RegisterUserFunc "WebElement", "DeviceClick", "DeviceClick"
Created by GeSHI 1.0.7.20
Then you can choose whether to use Click or DeviceClick.
http://www.advancedqtp.com/forums/index.php/topic,584.0.html
Try to run with mouse events, instead of browser events.
Code
GeSHi (qtp):
Setting.WebPackage("ReplayType") = 2 'Mouse events (browser events = 1)
Created by GeSHI 1.0.7.20
I would like to elaborate on Meir's answer, by default QTP communicates with browser objects via DOM events this means that:
Browser().Page().WebElement().Click
Is equivalent to:
Browser().Page().WebElement().Object.Click
If the web application listens to other events they will not be produced. When using device replay QTP physically moves the mouse cursor and simulates a click so it's much closer emulating a user action. I would recommend localizing this change to a function library.
Code
GeSHi (qtp):
Public Function DeviceClick(test_object)
replayType =Setting.WebPackage("ReplayType")' save old state
Setting.WebPackage("ReplayType") = 2
test_object.Click
Setting.WebPackage("ReplayType") = replayType
End Function
RegisterUserFunc "WebElement", "DeviceClick", "DeviceClick"
Created by GeSHI 1.0.7.20
Then you can choose whether to use Click or DeviceClick.
QTP - Register Global Dictionary in REGISTRY
Ref: SQAforums
For memory saving dictionary object you can save in registory like the following options
When you want to share data between different actions in a test, dictionary object can be used. To do this you should create a reserved test object for the Dictionary object. Here is a process to set up a reserved dictionary object. [Source]
1.Open Window’s registry by opening a Run window and entering regedit.
2.Navigate to HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects.
3.Create a new key (folder) named GlobalDictionary by right-clicking on the ReservedObjects key and selecting New -> Key.
4.Under the new key, create a String value named ProgID by right-clicking on GlobalDictionary and selecting New -> String Value.
5.Assign “Scripting.Dictionary” to the new ProgID string value by right-clicking on ProgID and selecting “Modify.”
6.If QTP window is already open you need to close and restart it.
7.Now to check whether dictionary object was installed successfully in registry, simple write GlobalDictionary. (don’t forget the dot) and you should see a drop-down containing all methods and properties associated with dictionary object
For memory saving dictionary object you can save in registory like the following options
When you want to share data between different actions in a test, dictionary object can be used. To do this you should create a reserved test object for the Dictionary object. Here is a process to set up a reserved dictionary object. [Source]
1.Open Window’s registry by opening a Run window and entering regedit.
2.Navigate to HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects.
3.Create a new key (folder) named GlobalDictionary by right-clicking on the ReservedObjects key and selecting New -> Key.
4.Under the new key, create a String value named ProgID by right-clicking on GlobalDictionary and selecting New -> String Value.
5.Assign “Scripting.Dictionary” to the new ProgID string value by right-clicking on ProgID and selecting “Modify.”
6.If QTP window is already open you need to close and restart it.
7.Now to check whether dictionary object was installed successfully in registry, simple write GlobalDictionary. (don’t forget the dot) and you should see a drop-down containing all methods and properties associated with dictionary object
Friday
QTP- Ordinal identifier
Mercury QuickTest Professional User's Guide > Working with Advanced Testing Features > Configuring Object Identification > Understanding the Object Identification Dialog Box > Selecting an Ordinal Identifier
--------------------------------------------------------------------------------
Selecting an Ordinal Identifier
In addition to learning the mandatory and assistive properties specified in the Object Identification dialog box (Tools > Object Identification), QuickTest can also learn 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 QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.
Because the assigned ordinal property value is a relative value and is accurate only in relation to the other objects displayed when QuickTest learns an object, changes in the layout or composition of your application page or screen could cause this value to change, even though the object itself has not changed in any way. For this reason, QuickTest learns a value for this backup ordinal identifier only when it cannot create a unique description using all available mandatory and assistive properties.
In addition, even if QuickTest learns an ordinal identifier, it will use it during the run session only if the learned description and the Smart Identification mechanism are not sufficient to identify the object in your application. If QuickTest can use other test object properties to identify the object during a run session, the ordinal identifier is ignored.
QuickTest can use the following types of ordinal identifiers to identify an object:
Index—Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description. For more information, see Identifying an Object Using the Index Property.
Location—Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. For more information, see Identifying an Object Using the Location Property.
CreationTime (Browser object only)—Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. For more information, see Identifying an Object Using the CreationTime Property.
By default, an ordinal identifier type exists for each test object class. To modify the default ordinal identifier, you can select the desired type from the Ordinal identifier box.
Tip: While recording, if QuickTest successfully creates a unique test object description using the mandatory and assistive properties, it does not learn an ordinal identifier value. You can add an ordinal identifier to an object's test object properties at a later time using the Add/Remove option from the Object Properties or Object Repository dialog box. For more information, see Working with Test Objects.
Identifying an Object Using the Index Property
While learning an object, QuickTest can assign a value to the test object's Index property to uniquely identify the object. The value is based on the order in which the object appears within the source code. The first occurrence is 0.
Index property values are object-specific. Therefore, if you use Index:=3 to describe a WebEdit test object, QuickTest searches for the fourth WebEdit object in the page. However, if you use Index:=3 to describe a WebElement object, QuickTest searches for the fourth Web object on the page—regardless of the type—because the WebElement object applies to all Web objects.
For example, suppose a page contains the following objects:
an image with the name Apple
an image with the name UserName
a WebEdit object with the name UserName
an image with the name Password
a WebEdit object with the name Password
The following statement refers to the third item in the list, as this is the first WebEdit object on the page with the name UserName:
WebEdit("Name:=UserName", "Index:=0")
In contrast, the following statement refers to the second item in the list, as that is the first object of any type (WebElement) with the name UserName:
WebElement("Name:=UserName", "Index:=0")
Identifying an Object Using the Location Property
While learning an object, QuickTest can assign a value to the test object's Location property to uniquely identify the object. The value is based on the order in which the object appears within the window, frame, or dialog box, in relation to other objects with identical properties. The first occurrence of the object is 0. Values are assigned in columns from top to bottom, and left to right.
In the following example, the radio buttons in the dialog box are numbered according to their location property.
Location property values are object-specific. Therefore, if you use Location:=3 to describe a WinButton test object, QuickTest searches from top to bottom, and left to right for the fourth WinButton object in the page. However, if you use Location:=3 to describe a WinObject object, QuickTest searches from top to bottom, and left to right for the fourth standard object on the page—regardless of the type—because the WinObject object applies to all standard objects.
For example, suppose a dialog box contains the following objects:
a button object with the name OK
a button object with the name Add/Remove
a check box object with the name Add/Remove
a button object with the name Help
a check box object with the name Check spelling
The following statement refers to the third item in the list, as this is the first check box object on the page with the name Add/Remove.
WinCheckBox("Name:=Add/Remove", "Location:=0")
In contrast, the following statement, refers to the second item in the list, as that is the first object of any type (WinObject) with the name Add/Remove.
WinObject("Name:=Add/Remove", "Location:=0")
Identifying an Object Using the CreationTime Property
While learning a browser object, if QuickTest is unable to uniquely identify the object according to its test object description, it assigns a value to the CreationTime test object property. This value indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. The first browser that opens receives the value CreationTime = 0.
During the run session, if QuickTest is unable to identify a browser object based solely on its test object description, it examines the order in which the browsers were opened, and then uses the CreationTime property to identify the correct one.
For example, if you record a test or component on three otherwise identical browsers that are opened at 9:01 pm, 9:03 pm, and 9:05 pm, QuickTest assigns the CreationTime values, as follows: CreationTime = 0 to the 9:01 am browser, CreationTime = 1 to the 9:03 am browser, and CreationTime = 2 to the 9:06 am browser.
At 10:30 pm, when you run your test or component, suppose the browsers are opened at 10:31 pm, 10:33 pm, and 10:34 pm. QuickTest identifies the browsers, as follows: the 10:31 pm browser is identified with the browser test object with CreationTime = 0, 10:33 pm browser is identified with the test object with CreationTime = 1, 10:34 pm browser is identified with the test object with CreationTime = 2.
If there are several open browsers, the one with the lowest CreationTime is the first one that was opened and the one with the highest CreationTime is the last one that was opened. For example, if there are three or more browsers open, the one with CreationTime = 2 is the third browser that was opened. If seven browsers are opened during a recording session, the browser with CreationTime = 6 is the last browser opened.
If a step was recorded on a browser with a specific CreationTime value, but during a run session there is no open browser with that CreationTime value, the step will run on the browser that has the highest CreationTime value. For example, if a step was recorded on a browser with CreationTime = 6, but during the run session there are only two open browsers, with CreationTime = 0 and CreationTime = 1, then the step runs on the last browser opened, which in this example is the browser with CreationTime=1.
Note: It is possible that at a particular time during a session, the available CreationTime values may not be sequential. For example, if you open six browsers during a record or run session, and then during that session, you close the second and fourth browsers (CreationTime values 1 and 3), then at the end of the session, the open browsers will be those with CreationTime values 0, 2, 4, and 5).
--------------------------------------------------------------------------------
Selecting an Ordinal Identifier
In addition to learning the mandatory and assistive properties specified in the Object Identification dialog box (Tools > Object Identification), QuickTest can also learn 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 QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.
Because the assigned ordinal property value is a relative value and is accurate only in relation to the other objects displayed when QuickTest learns an object, changes in the layout or composition of your application page or screen could cause this value to change, even though the object itself has not changed in any way. For this reason, QuickTest learns a value for this backup ordinal identifier only when it cannot create a unique description using all available mandatory and assistive properties.
In addition, even if QuickTest learns an ordinal identifier, it will use it during the run session only if the learned description and the Smart Identification mechanism are not sufficient to identify the object in your application. If QuickTest can use other test object properties to identify the object during a run session, the ordinal identifier is ignored.
QuickTest can use the following types of ordinal identifiers to identify an object:
Index—Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description. For more information, see Identifying an Object Using the Index Property.
Location—Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. For more information, see Identifying an Object Using the Location Property.
CreationTime (Browser object only)—Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. For more information, see Identifying an Object Using the CreationTime Property.
By default, an ordinal identifier type exists for each test object class. To modify the default ordinal identifier, you can select the desired type from the Ordinal identifier box.
Tip: While recording, if QuickTest successfully creates a unique test object description using the mandatory and assistive properties, it does not learn an ordinal identifier value. You can add an ordinal identifier to an object's test object properties at a later time using the Add/Remove option from the Object Properties or Object Repository dialog box. For more information, see Working with Test Objects.
Identifying an Object Using the Index Property
While learning an object, QuickTest can assign a value to the test object's Index property to uniquely identify the object. The value is based on the order in which the object appears within the source code. The first occurrence is 0.
Index property values are object-specific. Therefore, if you use Index:=3 to describe a WebEdit test object, QuickTest searches for the fourth WebEdit object in the page. However, if you use Index:=3 to describe a WebElement object, QuickTest searches for the fourth Web object on the page—regardless of the type—because the WebElement object applies to all Web objects.
For example, suppose a page contains the following objects:
an image with the name Apple
an image with the name UserName
a WebEdit object with the name UserName
an image with the name Password
a WebEdit object with the name Password
The following statement refers to the third item in the list, as this is the first WebEdit object on the page with the name UserName:
WebEdit("Name:=UserName", "Index:=0")
In contrast, the following statement refers to the second item in the list, as that is the first object of any type (WebElement) with the name UserName:
WebElement("Name:=UserName", "Index:=0")
Identifying an Object Using the Location Property
While learning an object, QuickTest can assign a value to the test object's Location property to uniquely identify the object. The value is based on the order in which the object appears within the window, frame, or dialog box, in relation to other objects with identical properties. The first occurrence of the object is 0. Values are assigned in columns from top to bottom, and left to right.
In the following example, the radio buttons in the dialog box are numbered according to their location property.
Location property values are object-specific. Therefore, if you use Location:=3 to describe a WinButton test object, QuickTest searches from top to bottom, and left to right for the fourth WinButton object in the page. However, if you use Location:=3 to describe a WinObject object, QuickTest searches from top to bottom, and left to right for the fourth standard object on the page—regardless of the type—because the WinObject object applies to all standard objects.
For example, suppose a dialog box contains the following objects:
a button object with the name OK
a button object with the name Add/Remove
a check box object with the name Add/Remove
a button object with the name Help
a check box object with the name Check spelling
The following statement refers to the third item in the list, as this is the first check box object on the page with the name Add/Remove.
WinCheckBox("Name:=Add/Remove", "Location:=0")
In contrast, the following statement, refers to the second item in the list, as that is the first object of any type (WinObject) with the name Add/Remove.
WinObject("Name:=Add/Remove", "Location:=0")
Identifying an Object Using the CreationTime Property
While learning a browser object, if QuickTest is unable to uniquely identify the object according to its test object description, it assigns a value to the CreationTime test object property. This value indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. The first browser that opens receives the value CreationTime = 0.
During the run session, if QuickTest is unable to identify a browser object based solely on its test object description, it examines the order in which the browsers were opened, and then uses the CreationTime property to identify the correct one.
For example, if you record a test or component on three otherwise identical browsers that are opened at 9:01 pm, 9:03 pm, and 9:05 pm, QuickTest assigns the CreationTime values, as follows: CreationTime = 0 to the 9:01 am browser, CreationTime = 1 to the 9:03 am browser, and CreationTime = 2 to the 9:06 am browser.
At 10:30 pm, when you run your test or component, suppose the browsers are opened at 10:31 pm, 10:33 pm, and 10:34 pm. QuickTest identifies the browsers, as follows: the 10:31 pm browser is identified with the browser test object with CreationTime = 0, 10:33 pm browser is identified with the test object with CreationTime = 1, 10:34 pm browser is identified with the test object with CreationTime = 2.
If there are several open browsers, the one with the lowest CreationTime is the first one that was opened and the one with the highest CreationTime is the last one that was opened. For example, if there are three or more browsers open, the one with CreationTime = 2 is the third browser that was opened. If seven browsers are opened during a recording session, the browser with CreationTime = 6 is the last browser opened.
If a step was recorded on a browser with a specific CreationTime value, but during a run session there is no open browser with that CreationTime value, the step will run on the browser that has the highest CreationTime value. For example, if a step was recorded on a browser with CreationTime = 6, but during the run session there are only two open browsers, with CreationTime = 0 and CreationTime = 1, then the step runs on the last browser opened, which in this example is the browser with CreationTime=1.
Note: It is possible that at a particular time during a session, the available CreationTime values may not be sequential. For example, if you open six browsers during a record or run session, and then during that session, you close the second and fourth browsers (CreationTime values 1 and 3), then at the end of the session, the open browsers will be those with CreationTime values 0, 2, 4, and 5).
QTP- FAQ
Capture Error Screen Shots
If error pop up comes during execution then how will you capture the error screen shot and where it is stored?
Latest Answer: Use Desktop.CaptureBitmap to capture the screenshotSample codeDesktop.CaptureBitmap "C:TempStep1.png" ...
Based of Ordinal Identifiers
When ordinal identifiers alone can make an object unique then why they are not given top priority? Why it is first mandatory and next assitive. Why we cannot go for ordinal identifiers directly?
I belive Location and Index will be recognized based on screen co-ordinates. So when you run the same script on different location and index my differ. At the same time if the object are having the child objects it will give the sam location id. So when you run the script it may get fail some times.
Connect QTP with QC
OTAClient.dll should register
1. Go to Start -> Run.
2. Enter regedit to bring up your registry.
3. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\OTA
4. Check the value of CacheFolder ,by default it is %temp%\TD_80 .Access the Cache location , right click and check the permissions .The folder should have full permissions .
5.Also try creating a new folder and edit the CacheFolder location to it .
so after you have point the new folder to the cache folder do the following steps
Start > Run
regsvr32 -u "C:\Program Files\Common Files\Mercury Interactive\Quality Center\OTAClient.dll"
regsvr32 "C:\Program Files\Common Files\Mercury Interactive\Quality Center\OTAClient.dll"
QTP Regular Expression
What is the significance of regular expression in QTP?
If error pop up comes during execution then how will you capture the error screen shot and where it is stored?
Latest Answer: Use Desktop.CaptureBitmap to capture the screenshotSample codeDesktop.CaptureBitmap "C:TempStep1.png" ...
Based of Ordinal Identifiers
When ordinal identifiers alone can make an object unique then why they are not given top priority? Why it is first mandatory and next assitive. Why we cannot go for ordinal identifiers directly?
I belive Location and Index will be recognized based on screen co-ordinates. So when you run the same script on different location and index my differ. At the same time if the object are having the child objects it will give the sam location id. So when you run the script it may get fail some times.
Connect QTP with QC
OTAClient.dll should register
1. Go to Start -> Run.
2. Enter regedit to bring up your registry.
3. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\OTA
4. Check the value of CacheFolder ,by default it is %temp%\TD_80 .Access the Cache location , right click and check the permissions .The folder should have full permissions .
5.Also try creating a new folder and edit the CacheFolder location to it .
so after you have point the new folder to the cache folder do the following steps
Start > Run
regsvr32 -u "C:\Program Files\Common Files\Mercury Interactive\Quality Center\OTAClient.dll"
regsvr32 "C:\Program Files\Common Files\Mercury Interactive\Quality Center\OTAClient.dll"
QTP Regular Expression
What is the significance of regular expression in QTP?
QTP - Get future date/ working date
From SQAfornm:
a=GetTDate(6)
msgbox a
Public Function GetTDate(iDays)
Dim dDate, iDir, d, i
dDate = Date
If iDays > -1 Then iDir = 1 else iDir = -1 end if
For i = 1 to Abs(iDays)
d = DateAdd("d", iDir, dDate)
While DatePart("w", d) = 7 or DatePart("w", d) = 1
d = DateAdd("d", iDir, d)
Wend
dDate = d
Next
GetTDate = dDate
End Function
You can use the DateAdd function to add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now. To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").
The DateAdd function won't return an invalid date. The following example adds one month to January 31:
NewDate = DateAdd("m", 1, "31-Jan-95")
In this case, DateAdd returns 28-Feb-95, not 31-Feb-95. If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.
If the calculated date would precede the year 100, an error occurs.
If number isn't a Long value, it is rounded to the nearest whole number before being evaluated
DatePart(interval, date[, firstdayofweek[, firstweekofyear]])
a=GetTDate(6)
msgbox a
Public Function GetTDate(iDays)
Dim dDate, iDir, d, i
dDate = Date
If iDays > -1 Then iDir = 1 else iDir = -1 end if
For i = 1 to Abs(iDays)
d = DateAdd("d", iDir, dDate)
While DatePart("w", d) = 7 or DatePart("w", d) = 1
d = DateAdd("d", iDir, d)
Wend
dDate = d
Next
GetTDate = dDate
End Function
You can use the DateAdd function to add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now. To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").
The DateAdd function won't return an invalid date. The following example adds one month to January 31:
NewDate = DateAdd("m", 1, "31-Jan-95")
In this case, DateAdd returns 28-Feb-95, not 31-Feb-95. If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.
If the calculated date would precede the year 100, an error occurs.
If number isn't a Long value, it is rounded to the nearest whole number before being evaluated
DatePart(interval, date[, firstdayofweek[, firstweekofyear]])
QTP-QTP Object Model
http://quicktestprofessional.wordpress.com/category/automation-object-model-for-qtp/
What is the QuickTest Automation Object Model?
You can use the QuickTest Professional Automation Object Model to write programs that automate your QuickTest operations. The QuickTest Automation Object Model provides objects, methods, and properties that enable you to control QuickTest from another application.
The new QuickTest Professional Automation Object Model enables you to automate test management.
You can now control virtually every QuickTest feature and capability using the objects, methods and properties included in the QuickTest Professional Automation Object Model. Automation scripts make it easy to perform any QuickTest operation multiple times in multiple tests without having to open the QuickTest application, for example,
You can write a script that modifies the test object description properties in the Object Identification dialog box and performs an update run on all tests in a specified file folder.
After installing a new add-in, an automation script can associate this add-in to all relevant tests.
You can write an automation script to run a selected batch of tests. For each test, you can retrieve the associated add-ins list. Then, if the necessary add-ins are not already loaded, you can close QuickTest, load the necessary add-ins, reopen QuickTest, and run the test.
You can define your settings for a test in QuickTest, then click “Generate Script” in the Generate tab of the Test Settings dialog box to generate an automation script based on the current test settings. You can then apply those same settings automatically to multiple tests using the whole automation script or excerpts from the generated file.
Example:
You can create and run an automation program from Microsoft Visual Basic that loads the required add-ins for a test, starts QuickTest in visible or minimized 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.
Creating automation programs:
The Properties tab of the Test Settings dialog box, the General tab of the Options dialog box, and the Object Identification dialog box each contain a “Generate Script” button. Clicking this button generates a automation script file (.vbs) containing the current settings from the corresponding dialog box.
You can run the generated script as is to open QuickTest with the exact configuration of the QuickTest application that generated the script, or you can copy and paste selected lines from the generated files into your own automation script.
Generating an automation script for QuickTest Professional options:
1. Go to Tools -> Options.
2. Select the General tab.
3. Click.
4. Save the script to the desired location.
5. Click to close the Options dialog.
Generating an automation script for test settings:
1. Go to Test -> Settings.
2. Select the Properties tab.
3. Click.
4. Save the script to the desired location.
5. Click to close the Test Settings dialog.
Generating an automation script for object identification settings:
1. Go to Tools -> Object Identification.
2. Click.
3. Save the script to the desired location.
4. Click to close the Object Identification dialog.
The QuickTest Automation Object Model Reference file is a help file that provides detailed descriptions, syntax information, and examples for the objects, methods, and properties in the QuickTest Automation Object Model.
When QuickTest Professional 6.5 is installed you can open the QuickTest Automation Object Model Reference from:
The QuickTest program folder (Start -> Programs -> QuickTest Professional -> Documentation -> Automation Object Model Reference)
The QuickTest Help menu (Help -> QuickTest Automation Object Model Reference)
Source: Mercury Forum’s KB articles
What is the QuickTest Automation Object Model?
You can use the QuickTest Professional Automation Object Model to write programs that automate your QuickTest operations. The QuickTest Automation Object Model provides objects, methods, and properties that enable you to control QuickTest from another application.
The new QuickTest Professional Automation Object Model enables you to automate test management.
You can now control virtually every QuickTest feature and capability using the objects, methods and properties included in the QuickTest Professional Automation Object Model. Automation scripts make it easy to perform any QuickTest operation multiple times in multiple tests without having to open the QuickTest application, for example,
You can write a script that modifies the test object description properties in the Object Identification dialog box and performs an update run on all tests in a specified file folder.
After installing a new add-in, an automation script can associate this add-in to all relevant tests.
You can write an automation script to run a selected batch of tests. For each test, you can retrieve the associated add-ins list. Then, if the necessary add-ins are not already loaded, you can close QuickTest, load the necessary add-ins, reopen QuickTest, and run the test.
You can define your settings for a test in QuickTest, then click “Generate Script” in the Generate tab of the Test Settings dialog box to generate an automation script based on the current test settings. You can then apply those same settings automatically to multiple tests using the whole automation script or excerpts from the generated file.
Example:
You can create and run an automation program from Microsoft Visual Basic that loads the required add-ins for a test, starts QuickTest in visible or minimized 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.
Creating automation programs:
The Properties tab of the Test Settings dialog box, the General tab of the Options dialog box, and the Object Identification dialog box each contain a “Generate Script” button. Clicking this button generates a automation script file (.vbs) containing the current settings from the corresponding dialog box.
You can run the generated script as is to open QuickTest with the exact configuration of the QuickTest application that generated the script, or you can copy and paste selected lines from the generated files into your own automation script.
Generating an automation script for QuickTest Professional options:
1. Go to Tools -> Options.
2. Select the General tab.
3. Click
4. Save the script to the desired location.
5. Click
Generating an automation script for test settings:
1. Go to Test -> Settings.
2. Select the Properties tab.
3. Click
4. Save the script to the desired location.
5. Click
Generating an automation script for object identification settings:
1. Go to Tools -> Object Identification.
2. Click
3. Save the script to the desired location.
4. Click
The QuickTest Automation Object Model Reference file is a help file that provides detailed descriptions, syntax information, and examples for the objects, methods, and properties in the QuickTest Automation Object Model.
When QuickTest Professional 6.5 is installed you can open the QuickTest Automation Object Model Reference from:
The QuickTest program folder (Start -> Programs -> QuickTest Professional -> Documentation -> Automation Object Model Reference)
The QuickTest Help menu (Help -> QuickTest Automation Object Model Reference)
Source: Mercury Forum’s KB articles
Subscribe to:
Posts (Atom)