Advanced Testing in Visual Studio 2010 Team Foundation Server

by Dmitry Kirsanov 4. January 2012 17:10

Team Foundation Server 2010This is part 4 of Visual Studio Team Foundation Server 2010 for Developers walkthrough. Last time we were speaking about the unit tests, and that was useful, but very basic foundation of what you can do in terms of Test Driven Development. However, we can conventionally separate testing in Visual Studio and Team Foundation Server to 3 levels. So today we are going to talk about the second level – Advanced Testing techniques, such as Test Impact Analysis, Coded UI Tests and Load Tests.

If that’s only the middle layer of complex testing in Visual Studio 2010, what’s in the last one, you might ask? There will be test automation using Hyper-V virtualization with Virtual Machine Manager and yes, we will discuss it later as well.

But today we’ll begin with Test Impact Analysis.

Imagine, that you have built a good unit test coverage for your big project. Hundreds of unit tests, perhaps even thousands after awhile. A group of perfect developers is changing hundreds lines of code in numerous classes and you never know how it changed (I didn’t say “broke”!) the old functionality. Well, at least until you run the unit tests.

However, running all unit tests during the build is inefficient, as it could steal minutes of precious time, when you are having the most concentration on work. To avoid loosing productivity, what you should use is the feature called Test Impact Analysis, which monitors what changes are covered by what tests  and offers you to run only those unit tests affected by your recent activity.

Take a look at the video below to see how easy it is to implement. Beware, though, that you should have Visual Studio 2010 of at least Professional edition in order to have access to that functionality. Premium or Ultimate have it as well, and if you don’t have it – remember, that Microsoft has the trial edition of Visual Studio 2010, which is Ultimate edition 90-day trial.

The next big thing in Visual Studio is Coded UI Test – function, which allows you to create User Interface tests. Using that functionality, you can record activity, such as clicks on elements and entering values, which emulates the usual activity of your users. Coded UI Tests may be split by steps, which then may be shared among different tests. So, for example, if one of your steps is to execute the application, then quite obviously you’ll want to repeat that action in all other tests, and so you can re-use that operation.

Team Foundation Server 2010 can run the Coded UI Tests as easy as any other unit tests whenever you like, so you can add them to the lists of unit tests which should be run during the nightly builds, for example. Coded UI Tests are especially intensively used by Windows Applications developers, but it has it’s counterpart in Web Developer’s world as well.

The last advanced feature of Microsoft Visual Studio 2010 unit testing that I am showing in this video is Load Testing. This feature is incredibly handy for ASP.NET developers who must be able to give estimates on how reliable and scalable their system is. How many concurrent users may be supported by your web application, for instance? What is the impact on server resources during the “load attack”?

In part 6 of the walk-through, we will talk about applying deep metrics to your web application, using the profiling tools, so you would be able to tell just how much efforts it takes from your server to perform any specific action. How much time you waste on inefficient data access, for example, and how much you gain after you apply another method. But now – we will see how we can simulate the concurrent use of our website by multiple users using different browsers on different networks and performing their own actions.

If you are ASP.NET developer and never used the Load Testing, then perhaps this part will be the most interesting one for you.

The next, 5th part, will be about the Architecture – the least used but most stunning part of Visual Studio 2010 which enables you to perform amazing project review and documentation using only mouse and brain. I suppose I will do it within a week or two, so stay tuned and use a moment to subscribe to either YouTube channel or even better – to the blog itself (see the Subscription panel at the right side) either directly or through Google Reader / Feedburner.

Team Foundation Server 2010 for Developers, part 4 - Advanced Unit Testing
blog comments powered by Disqus