Testing improvements and editing Coded UI tests with Visual Studio 2010 Feature Pack 2

Recently, for MSDN Subscribers, Microsoft has launched the Visual Studio 2010 Feature Pack 2, which, also contains all new features included in the first Feature Pack. It can be downloaded here: http://msdn.microsoft.com/en-us/vstudio/ff655021.aspx

Apart from a lot of improvements in the modeling tools, there are new cool features for testing applications, two big improvements are the support of being able to record one coded UI or manual test in Internet Explorer and playback it in Mozilla Firefox, a really must-have for all web developers, also they have introduced the possibility of test Silverlight 4 applications with coded UI tests or action recordings, cool.

But there is one new tool I have been using these days, the new Coded UI Test Editor. If you have been using coded UI tests, you will know, after creating the tests, doing some changes in them, manually, is almost a pain.

So how can we use this new tool? Ok, in the project we have our coded UI tests, we have a file called UIMap.uitest just double-click this file, or with the right button select open, and it will open a window like this one:

image_thumb1

Here we have in the left side, the UI actions recorded and asserts, you can notices the icon difference between them, and, in the right side we have the controls which have been mapped from the recordings.

And what can we do? here you have a complete tutorial of the possibilities of this tools: http://msdn.microsoft.com/en-US/library/gg269469.aspx

This includes options like delete an action we don’t want anymore, divide an action recording into several methods to be more easily maintained, extract one complete method to another class file, rename methods, a lot of things.

But here comes the downsize of this tool, let’s imagine we rename the action “Abrirurl” (sorry for the Spanish), to “OpenURL”, well we are used to refactoring tools inside Visual Studio, but this time, when we choose to rename, it will be only renamed in the UIMap.uitest file, so, we will have to go manually to all UI tests which used that method, and change to the new method name, not so good, as it is a feature (renaming methods) which has been so long in Visual Studio.

It happens also if we decide to break one long recording into several methods, let’s say we have this action recording method:

image_thumb3

Almost everyone will agree is a long action recording, and can be more readable i f we break it into several methods, so we right click on any action inside it, and choose Split into a new method:

image_thumb5

It will break this method in two, and all the actions from the one we selected will go into a new method, but here is the downsize, in the place we used the original method, we will have to go, and manually, add the call to the newly created method.

It happens with some more options of this tool, but don’t worry too much, the tool will always advise you about this kind of things, so take care to read any pop-up which will appear when using this tool.

Conclusions? Well, I really like this new tool, and all the new advantages of the Feature Pack 2, but take care when using it, as it involves some manual work in some cases, that’s all. Maybe in a future Feature Pack, all this things will be done automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *