Testing Microsoft Access Applications With TestComplete - Part 2
Posted by
Alex Kuzin on Mon, Oct 30, 2006 @ 02:07 AM
The previous article (Testing Microsoft Access Applications With TestComplete - Part 1) states that to test Microsoft Access applications, you have to use both the MSAA engine and COM interfaces to access the application's forms and controls. The article explains how you can use the MSAA functionality to simulate user actions over forms and controls.
This article explains how to work with forms via COM. Like in Part 1, I'm going use the Northwind database shipped with Microsoft Access 2003.
When exploring your Access application in the Object Browser, you may notice that even though the MSAA Open Applications plug-in provides access to form elements, it does not expose the element's properties and methods that you can edit in the Microsoft Access's Properties window. To get these properties in TestComplete, you can create a script that will work with Microsoft Access via COM.
Microsoft Access is a COM server and its internals can be accessed from a COM client application. To explore the internal object structure, you can use TestComplete's Object Browser:
For complete information on Microsoft Access objects, properties and methods, see Microsoft Access documentation.
The following code snippet demonstrates how to modify the caption of the Products button that resides on the Main Switchboard form of the Northwind database. Note that before working with a form via OLE, make sure the form is visible on screen.
The following code demonstrates how to change the value of the Bill To box that resides on the Orders form of the Northwind database.
As you can see, accessing Microsoft Access forms and their elements does not differ much from accessing the forms and form elements from Microsoft Access script modules. To create complex scripts, you need to know the object model and the object methods and properties described in Microsoft Access documentation.