Test Design StudioGo to Previous Topic: CA0110 - Invalid use of Test Object 'Exist' propertyGo to Next Topic: CA0112 - Invalid assignment statement

CA0111 - Cannot instantiate external classes


User-defined classes in VBScript are instantiated using the New keyword. Unified Functional Testing has a limitation where you can only instantiate user-defined classes that are declared in the same script where you are attempting to instantiate it.


A simple trick to overcome this limitation is to declare a Function that will accompany your Class, and this function will serve the purpose of instantiating a new instance of the class and returning that instance to the calling routine.

The following sample code illustrates how you could declare a function to go with your class:

[VBScript] - Copy Code
Class MyUserDefinedClass
End Class

Public Function NewClass_MyUserDefinedClass
    ' Instantiate and return new instance of the class
    Set NewClass_MyUserDefinedClass = New MyUserDefinedClass
End Function

In the external file that needs to create an instance of this class, you will simply call the function you created instead of trying to instantiate it directly:

[VBScript] - Copy Code
Dim myClassInstance
Set myClassInstance = NewClass_MyUserDefinedClass