Alias Keyword in Type Declarations for Recording .NET Classes

Syntax for 4Test Enum Data Type

[scope] TYPE type-name IS ENUM ALIAS classname

where classname is the .NET class name enumeration-values

Syntax for 4Test Record Data Type

[scope] TYPE type-name IS RECORD ALIAS classname

where classname is the .NET class name

Syntax for Record-Fields Using Alias Keyword

type-name field-name alias "fieldname"

where fieldname is the .NET class property name; fieldname must be in quotation marks

Syntax for Record-Fields Not Using Alias Keyword

type-name field-name

where field-name matches exactly the .NET class property name

Description

If you are using Record Class against .NET WinForms controls, you may be able to extend the list of properties and methods that are declared in the resulting winclass declaration.

Property and method declaration is directly related to whether or not there is a 4Test compatible data type for the property type or for a method's parameter type(s). By declaring new 4Test data types that are aliased from types used in the .NET WinForms application, you can extend the list of 4Test compatible data types. Specifically, enumeration types and record types declared in the .NET WinForms application are candidates for aliasing. See Rules for details.

For example, the sample Silk Test Classic .NET application uses the Microsoft .NET framework MonthCalendar control. Without any type aliasing, Record Class against the MonthCalendar control excludes a property declaration for the ClientSize property, as well as a method declaration for both set_ClientSize and get_ClientSize. However, with the following 4Test type declaration, these class members are included in the winclass definition:
type MyClientSize is record alias "System.Drawing.Size" 
INTEGER myWidth alias "Width" // or, alternatively, INTEGER Width
INTEGER myHeight alias "Height" // or, alternatively, INTEGER Height

Rules

Regardless of the property type or the method parameter types and any aliasing you may introduce, STATIC member properties and methods will be EXCLUDED from the winclass declaration generated by Record Class.

When declaring a new 4Test data type using the alias keyword, your choice for type-name does not have to match the name of the type in the .NET WinForms application.

If you are declaring a record data type, you can either have the field names match exactly with the corresponding field names in the .NET WinForms application, or you can use the alias keyword to define your own field names; in this case, the string used within the "" must match exactly (including capitalization) with the corresponding field names in the .NET WinForms application.

If you are declaring an enum data type, the enumeration values must match exactly with the enumeration values in the .NET WinForms application; you do not have the choice of using your own enumeration values and the alias keyword.

The .NET class must use a public constructor (in the example above, System.Drawing.Size)

The .NET class must be inherited from the .NET ValueType.