Test Design StudioGo to Previous Topic: Object Repository IntelliSenseGo to Next Topic: Using Code Snippets

Adding Project References

Project References

As previously mentioned, a Unified Functional Testing project already has references to the "VBScript" and "Unified Functional Testing" languages so that it can provide the core IntelliSense related to those items. As the needs of your project grow, you may need to add additional references to your project to streamline IntelliSense.

Why Do We Need a Reference?

Within Solution Explorer, locate and open the file StartupScript.vbs located under the Startup Script folder of our walkthrough project.

Around line 200 of the document, you will see the following line of code (#1 in the image above):

[VBScript] - Copy Code
Set App = CreateObject("QuickTest.Application")

This statement creates a reference to the "QuickTest.Application" COM object stored in the Unified Functional Testing Object Library. You will also notice the Smart Tag indicator is placed on this statement since we do not currently have a reference to that library.

Tip:    This type of Smart Tag was discussed earlier in the Walkthrough. We could use the Smart Tag to add a reference to the appropriate library, but we will manually add this reference for illustrative purposes.

Locate the following code around line 260 (#2 in the image above):

[VBScript] - Copy Code
App.Visible = True

This statement utilizes the Visible property of a QuickTest.Application COM object. If you hover the mouse over the property Visible, you will notice that no IntelliSense Quick Information is displayed. This is expected since we do not have a reference to the proper library. Without a reference to the library, Test Design Studio does not know details about the types defined in that library. We know IntelliSense makes us more productive coders, so we want to make sure we get IntelliSense for this object type.

Adding a COM Reference

Within Solution Explorer, locate and expand the References node under the project node. This will reveal the current references made by your project. To add an additional reference, right-click the References node (#1 in the image below) and select Add Reference... from the context menu (#2 in the image below).

This will display the Add Reference dialog.

A Unified Functional Testing project can create references to COM libraries, individual VBScript-based function libraries (VBS or QFL files), and other Unified Functional Testing projects stored in the same solution. For our walkthrough, we will create a reference to the Unified Functional Testing Object Library that is used to programmatically control Unified Functional Testing. This is the library that defines "QuickTest.Application". With the COM tab selected, scroll and select the Unified Functional Testing x.x Object Library. Once selected, click the OK button to add this reference.

The Add Reference dialog will close, and the References node in Solution Explorer will be updated with the new library reference.

Testing The New Reference

Now return to the editor and hover your mouse over the Visible property again. This time Test Design Studio is able to properly identify a QuickTest.Application object and will display the IntelliSense Quick Info for the Visible property of that object type (shown in the image above).

You may add references to as many COM libraries as is appropriate for your project. Other common COM libraries include the Microsoft Scripting Runtime library or the OTA COM Type Library used to interact with HPE Application Lifecycle Management. You will find more information about references here that will not be covered in the walkthrough.

You may now close the StartupScript.vbs document.