My name is Swati Bhat and I am a Senior SDET with Microsoft’s Sales and Marketing IT (SMIT) organization. Automation is a top priority for testing at Microsoft. Moving to an Agile software development lifecycle, we have been experimenting with ways for quick test turnaround. On my project, a web based application, we have several challenges. These automation challenges are due to the age of the application and the fact that the business logic is distributed across the UI (user interface), middle tier service and backend layers. Automating the middle service layer did not provide 100% user scenario coverage, and hence it was necessary to automate the UI .
Whenever we can, we try to avoid using UI layer automation because it tends to be less reliable and more time consuming to write, it can also be more complicated, as well as carries a higher maintenance cost. When needed, the Coded UI feature in the Visual Studio 2012 product has been a great tool to use for automation of UI test cases.

After automating our 1st set of cases we saw a lot of false positive failures due to unavailability of the web browser controls, due to slow web page load times. To solve this problem, we developed our own framework utilizing the CodedUI. This new framework mitigated our issues and made our runs more reliable. I’ll explain more on how we built this framework:

For this framework we defined:

  1. A class for each of the webpages and explicitly defined the controls with its properties.
  2. A TestHelper class which has the helper functions, these functions are based off Coded UI to do actions like input text, Click Buttons etc.
  3. And finally a set of Functional Tests which will use the Classes for the Individual webpages and the TestHelper class to interact between the pages.

The advantages of this type of framework are:

  • Maintenance of the code is easy as it does not generate a large code set, which is often the case when even automating small UI operations
  • It has great Code Reusability as there is no duplication of recorded methods for the same actions
  • It has improved performance as it uses specific Property – Value pairs to identify and locate the UI Controls

I have used this approach for two of my projects and both have been a success. I am now trying to setup Lab Environment in Microsoft Test Manager (MTM), a component of Visual Studio 2012, for running of tests on multiple agents at the same time. I will share my experience in my next post.