Bring automation to your UI tests
Many developers these days write unit tests in combination with integration tests to ensure that all the logical parts of an application is working correctly. The problem with both of these types of tests is that the UI and its presentation logic are not being tested.
So one way is to manually test the UI or the entire app, which can be rather time consuming if one wants to perform a series of tests over and over again or in other words if one wants a regression test. There are tools that record what is happening on the screen but these are rather brittle as they often rely on X/Y Coordinates which can lead to a failing test only because the screen resolution has changed. Further they often do not allow for modularisation of steps i.e. reuse common actions that are done by multiple tests. The main problem is that if a step changes in the UI all tests that are doing that step have to be entirely recorded again. Now there is a way to automate you test and avoid some of the most annoying pitfalls that often exist with other automation solutions. Well at least as long as you are developing for the Web or .Net on a Windows machine.
Now Microsoft provides us with Coded UI tests since Visual Studio 2010 and they have kept at it since then and brought some nice improvements with the release of Visual Studio 2012.
Getting started is actually really easy one only has to record the steps undertaken in during a UI test and then assert the wanted result is presented.
One of the main benefits of Coded UI tests compared to recorded UI tests is that they do not rely on X/Y coordinates but for XAML applications use the names of the elements to select a button. This means that even when the button moves it will still be found.
Further it allows to split up the steps undertaken in a test into reusable modules for other tests. So if tests share steps i.e. navigating through a dialog, and a UI change leads to a failing step. The fault step can be recorded again and all tests using that step will be updated automatic.
So yes Coded UI tests can still break, but the maintenance overhead can be reduced to a minimum.
Coded UI Tests are an extension to the MS Test framework, which is often used for unit, integration or system tests and therefore can be executed with all the other tests on the developer machine or on a build server like TFS.
To be able to use Coded UI Tests one has to have a Visual Studio Premium or Ultimate licence. Another thing one has to take into consideration is if the application one wants to test is supported by the Coded UI testing framework. Just check out this MSDN site to ensure you app is compatible for coded UI tests.
A great starting point for diving into Coded UI tests can be found here.