This project is read-only.

What is VSTO?

Visual Studio Tools for Office (VSTO) is a set of development tools available in the form of a Visual Studio add-in (project templates) and a runtime that allows Office applications to host the .NET Framework Common Language Runtime (CLR) to expose their functionality via the .NET type system.

This allows extensions to the Office applications to be written in CLI compliant languages as well as to use functionality and user interface constructs from Office applications in .NET applications.

You can use the Microsoft Office developer tools in Visual Studio 2010 to create .NET Framework applications that extend Microsoft Office 2010 and the 2007 Microsoft Office system. These applications are also named Office solutions.

The Office developer tools provide features that help you create Office solutions to suit a variety of business needs. The tools include project templates to help you create Office solutions by using Visual Basic or Visual C#, and visual designers that help you create custom user interfaces for your Office solutions.

Visual Studio 2010 provides project templates you can use to create document-level customizations and application-level add-ins for Microsoft Office Word. You can use these solutions to automate Word, extend Word features, and customize the Word user interface (UI).


Coded-UI is the out-of-box recording based test Automation tool provided in VSTS 2010. It is assumed here that the user will have a basic knowledge of the framework. This section focuses on using the coded-UI for creating test cases for Office applications, more specifically Word and Outlook. The workflow typically involves the following steps:

  1. Opening the word/outlook application
  2. Navigate to the required tab in the ribbon
  3. Click the required button in the ribbon

Alternatively, it is also feasible to add assertions in intermediate steps between the sequence of actions, for e.g. a test case may involve asserting the presence of a particular button /control and then clicking the button and verifying proper functionality. 


During the test case automation of our Office 2010 project using VSTS 2010 Coded-UI tests, we faced the following issues:

  1. Some action recordings failed, while trying to generate code, with the error ‘unable to find UI Object’. Even after much effort we were not able to find the root cause and consistent repro for this issue.
  2. While trying to add assertions for some controls, the same error, UI Object not found, was encountered. The root cause could not be found.
  3. While running the tests, they hung arbitrarily and got stuck for a long period. Sometimes they resumed automatically and passed/failed and many a times they had to be aborted and re run.

As per the product team at Microsoft IDC, they are not supporting Coded-UI on Office application as of now due to which there may be issues and also this is not on priority for them as of now. Therefore, in spite of its ease of use, if used in isolation it is not the best framework for VSTO automation.

Approach Suggested for Automation

 Automation testing using Coded UI is a known playground for testers. But as soon as they find out that Coded UI doesn’t support office applications, all doors seem closed for automation and the feasibility of automating such projects seem like a tough task and eventually a distant dream. The one instantly striking solution is building extensibility for the required office application, for which a sample is readily available online. Typically, building such a framework for an automation framework needs a lot of investment of time for the specific endeavor, which needs a lot of research & planning. Making this possible into consulting space is definitely a Himalayan effort.

If we take our thinking towards a little lateral, we might ask this question, “How is the development done? Why don’t I use the same methodology to verify the result? (This exactly is the manual tester’s job!!)” The next question is, “If the development is done event-driven, how are we going to drive the event?” The one answer to both the questions is, drive the events using Coded-UI and verify it using VSTO programming. This answer gives birth to a new flavor of UI automation. It can be called VSTO Programming flavored Coded UI automation.

Last edited May 1, 2012 at 11:25 AM by srilony, version 7