Description Objects

By XeroCube | May 9, 2008

When creating reusable actions in QuickTest Pro, there are times you may come across the need to dynamically access an object within your application that may or may not exist within your Object Repository. One approach to handling this opportunity is through the use of Description Objects.

I could spend a lot of time attempting to explain how to go about implementing description objects, but I have found that QTP’s help files do a good job explaining exactly what you need to do. To find what you are looking for, search for “Using Description Objects for Programmatic Descriptions” within the help file.

Now, here’s an example of code I’ve used within my reusable actions:


Option Explicit

' ---------------- Variable Declaration -------------------------
Dim objDescObject
'--------------------------------------------------------------------------

' Create the Description Object
Set objDescObject = Description.Create()

objDescObject("nativeclass").Value = "ThunderRT6OptionButton"
objDescObject("text").Value = Parameter("RadioButtonCaption")

VbWindow("frmMain").ActiveX("SSPanel").VbRadioButton(objDescObject).Set

This code could be rewritten as such:


Option Explicit

' ---------------- Variable Declaration -------------------------
Dim objDescObject
'--------------------------------------------------------------------------

' Create the Description Object
Set objDescObject = Description.Create()

VbWindow("frmMain").ActiveX("SSPanel").VbRadioButton("nativeclass:=ThunderRT6OptionButton", "text:=Include").Set

This is a simple example of this style of code. I’ve used it in conjunction with Action and Script parameters with great success.

Another site I’ve found with good information is quicktestprofessional.wordpress.com

Topics: Quality Assurance, QuickTest Pro, VBScript | No Comments »

Comments

Archives

Blogroll

RockinMedia