Accessibility looks more promising:
Active Accessibility (AA) is technology developed by Microsoft to make the Windows platform more accessible to people with disabilities. It consists of a set of COM interfaces and methods which allow an application to expose information to third parties, making it easier to implement tools such as magnifiers and screen readers. It proves very useful also for testing utilities. Microsoft has implemented the accessibility interfaces for the standard Windows controls.
AccExplorer (download) shows you the test application structure:
You see nice hierarchical window structure. Every object has several properties:
- Name - e.g. caption of button
- Value - e.g. value of list box
- Role Text - type of the component
- Location - position on the screen
- State - e.g. disabled, normal, etc.
- Def Action - default action for the component
- We still cannot distinguish the similar controls. Both buttons have role push buttons and can be distinguished only by displayed name. Which is problematic when names change or you need to test localized applications.
- Some components do not have name at all. In our example it is the text box - its name in AccExplorer is NAMELESS.
- The third party components usually lack support for the accessibility in the same quality as Microsoft. For example, DevExpress grid only tells you "I am a grid". It does not tell you how many rows it contains, what cells are there, etc...
Microsoft tries to address testing issues with his new framework in .NET 3.5: Microsoft UI Automation. I have not tried it as our applications do not run on .NET 3.5.
Also DevExpress promised to enhance their components with better support for UI testing tools - see the 2008 roadmap.
But we don't want to wait, right? We want to test our .NET application right now! I will show how in the next article.