Unit Testing with VS Team System - A First Glance (Updated)
Visual Studio Team System for Developers has built-in unit testing functionality. Like most unit testing suites, it has a wizard that quickly generates testing stubs for all of the classes and methods in a project.
One of the more useful features of the unit testing tools is the automatically created wrapper classes. These wrapper classes use reflection to expose all of the underlying type's private methods. This de-encapsulation functionality makes testing the internals of a class much easier.
Unfortunately Microsoft didn't put as much thought into testing objects that implement the IDisposable pattern. None of the testing stubs wrap the target in a using block, meaning a lot of resources are potentially leaked. This is an especially aggravating when testing classes that hold onto unique resources like files.
Another issue with VS Team System is that it doesn't support sets of tests very well. Unlike MbUnit, it doesn't support calling the same test multiple times using different data. The developer or test engineer has to make a copy of the test routine for each set of inputs, possibly with the aid of a hand-rolled helper function.
Correction
Eric Smith has pointed out that there is a DataSourceAttribute that allows test inputs to be stored in a database.
...
by
Jim Arnold
Re: ...
by
Jonathan Allen
If there are specific areas of VSTS or any other product you think we should have more coverage on, feel free to let me know.
Jonathan Allen
Jonathan@InfoQ.com
P.S. I really like the code analysis features of VSTS.
Re: ...
by
Jim Arnold
I would like to see an in depth assessment of working with VSTS as a dev/test/build environment, particularly as it compares to the Subversion/CC.Net/NUnit/NAnt "standard" stack that many of us are used to. Maybe a comparison with JetBrains' new TeamCity stuff? It's the day-to-day usage I'm interested in rather than the headline "test stub generation is cool" stuff (test stub generation is not cool :-) ).
Personally, I see nothing really compelling in VSTS, but having never used it in anger I might be missing something important.
Jim
Data-Driven Tests
by
Eric Smith
I'm not expert in the use of MbUnit to know if this is a valid comparison, but the Team System testing framework does have data-driven tests through the DataSourceAttribute. If you annotate a test method with that attribute, it will run the test for each row in the data source.
Educational Content
Concurrency in Clojure
Stuart Halloway May 17, 2013
Confessions of an Agile Addict
Ole Friis Østergaard May 16, 2013
Web Development: You're Doing It Wrong
Stefan Tilkov May 16, 2013
Programming The Feynman Way
Ben Evans May 15, 2013





Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think