background image
<< Class Hierarchy - Redefining a method | Class Hierarchy - Defining new verification properties >>
Class Hierarchy - Defining new class properties
<< Class Hierarchy - Redefining a method | Class Hierarchy - Defining new verification properties >>
308
User's Guide
16 E
XTENDING
THE
C
LASS
H
IERARCHY
Defining new class properties
Polymorphism
If a class defines its own version of a method or property, that method or
property overrides the one inherited from an ancestor. This is referred to as
polymorphism. For example, the ListBox class has its own GetContents
method, which overrides the GetContents method inherited from the AnyWin
class.
Defining a new
method for a single
GUI object
To define a new method to use on a single GUI object, not for an entire class
of objects, you add the method definition to the window declaration for the
individual object, not to the class. The syntax is exactly the same as when you
define a method for a class. For examples, see "Defining a method for a GUI
object" on page 97.
Defining new class properties
You can define new properties for existing classes using the property
statement. You use these class properties to hold data about an object; you
can use class properties anywhere in a script.
For complete information, see "property declaration" in online Help.
Defining new verification properties
You can perform verifications in your testcases using properties. These
verification properties are different than the class properties described in the
previous section, which are defined using the property statement.
Verification properties are used only when verifying the state of your
application in a testcase. SilkTest comes with built-in verification properties
for all classes of GUI objects.
Note For more information about verification using properties, see
"Verifying using properties" on page 115.
You can define your own verification properties, which will be added to the
built-in properties listed in the Verify Window dialog when you record a
testcase.
Procedure To define custom verification properties:
1
In a class declaration or in the declaration for an individual object, define
the variable lsPropertyNames as follows:
LIST OF STRING lsPropertyNames
2
Specify each of your custom verification properties as elements of the
list lsPropertyNames. Custom verification properties can be either: