Dr. Neil calls Microsoft out for their attempt to redefine Test-Driven Development to suite the product they have developed (Team System). I personally thing VSTS will help a great number of teams define a process for their group. Many development team I talk to don’t have an actual process. It’s more of the wild west. I use a mixture of XP an Scrum, and our Agile practices are very structured and disciplined. Waterfall falls somewhere in the middle on a discipline scale (and far out there on a reality scale). For cowboy teams or teams whose process isn’t reliably producing working software, I think VSTS will help to inforce a more disciplined and accountable software shop. Along with any product, it will be both abused and used for good. Kudos to Microsoft for putting this product together.

With all the good that it will bring with it’s increased focus on automated builds, static code analysis and automated testing, it has missed the boat on a few items regarding it’s automated testing support or what it claims to be. VSTS does come with testing support, and it can generate test stubs from production code, but it does not inherently support test-drivent development. TDD is simple:

RED (make a test, and make it fail)

GREEN (write production code to make the test pass)

REFACTOR (eliminate duplication)

It’s a cycle of 1 test to 1 production scenario, and TDD is test-first unit testing that helps shape the design of the production code as it emerges. Development is “test-driven”. That means that if you are developing and then generating tests, you are doing testing, but your development wasn’t “test-driven”, it was “test-trailored”, or whatever term you want to use.

VSTS testing tools will generate test stubs from production code, but they won’t generate a production method stub from a test (which is a well-used feature of Resharper). If you look at the process guidence on TDD from Microsoft, you’ll notice the attempt to redefine the process to fit the tool. They should modify to the tool to fit the already-proven process.

Another falacy exists in the guidance on creating “ASP.NET unit tests”. Microsoft seems to only focus on unit testing as a term, but they describe integration tests. Refer to Jeremy Miller’s post about the different types of tests. Unit tests test code in isolation. In other words, they test code while isolating dependencies from the code. Unit tests should always pass. Unit test only run custom code. If 3rd-party libaries or frameworks are required for a test to pass, then it is, by definition, not a unit test. It then becomes an integration test. The term “ASP.NET unit test” is a falacy. These tests, as Microsoft describes them, include the development webserver in the testing stack. This is a pretty significant dependency, and these are integration tests. Integration tests are important too, but they should be defined correctly.

I understand what you are trying to spell out to your readers, but test driven development can still be performed with VSTS. The truth is, MS built in the functionality to stub out unit tests, which is a nice feature if you have something that doesn’t already have unit tests against it. Nothing says this is how you should develop though. You can write a unit test first, and then write the production code to make the unit test pass. Sure, Resharper has a feature that Team System does not, but that doesn’t make TS un-usable, or even hard to use, with test driven development.

Brian,
You are absolutely right, and I will surely be using it to do TDD. You don’t need a specific IDE to do TDD. Specifically, their process guidence recommends creating production code and then generate tests for that, and that’s backwards. TDD recommends creating a test and then production code that satisfies the test.

I regularly need to catch myself to drop the “unit test” phrase and replace it with “test”. Reason: I don’t limit myself to pure unit testing, I do what is needed for the task at hand. That’s often “integration testing”, invariably mixed with “unit testing”. For me it’s just testing, the right testing.

Aspx testing is very important. Those who have tried to do it in the past know how much of a barrier that “web/app server” layer addds. (Sometimes make you wonder whether the who code drive web site idea has gone horribly wrong!) A lot will rejoice at this capability.

You can use the Class Designer for UML as Sketch (Fowler), where you draw UML in VS2005 and the raw classes are just transformed into clean classes. Create a test project, a reference to the implementation, create a test, and create a implementation stub. It _IS_ possible to create an empty method from a test.

More can be found on my blog, where I specify what I’ve done myself to come to the conclusion.

Whoops, moderating comments without getting noticed by Community Server isn’t the most pleasant way to work.

I’ve noticed now Jeffrey replied.

I think we’re both on the same track. Jeffrey was especially commeting about generating your tests from (empty?) classes. What I did was create empty classes, a test project and a test. Then created an implementation method from my test-method. This implementation method was the first method in my class, so it’d be impossible to generate ANY test any sooner.

I like the way it works, hope they fix the bug that VS2005 doesn’t notice all called methods don’t exist.

DawlinLi
1:54 am on October 28, 2005

Hi,

How do I unit test for event triggering? How can I check whether an event has been fired?