Skip navigation.

Impressed By the Visual Studio 2005 Team SystemAll recent postsBook Review: Pragmatic Unit Testing In C# with Nunit

Unit Testing Private Methods with VSTS

Another thing I’m digging about Visual Studio Team Developer Edition with two shovels is ability to run unit tests against private methods and properties. Books and articles on "traditional" testing with NUnit are quick to accuse you of improper design if you have private methods which you want to test. As a rule, their suggestion is to reconsider your design and declare private methods as public.

I don’t want to get into a discussion about it. Suffice it to say, if I introduce a private method to a class, I do it for a very good reason and it needs to be this way.

A helpful wizard within VSTS will generate reflection code for you to test private methods. Slick!

Comments

Comment permalink 1 Mike Gale |
A lot of discussion on testing generates more heat than light. As you say the tail often tries to wag the dog. (Like the use mock objects for everything theory I've seen promoted!!)

Even the common name (unit testing) is plain wrong in many cases. Often what you're doing is integration testing etc.

That is a cool feature in the VSTS version.

From my viewpoint though MS has got the whole VSTS design badly wrong. They want to snag specialised corporate developers who are only performance testers, only architects or only code testers. What about the developer who is all of these things, who has managed to cut out a great deal of low productivity "communication time". Who has recently been frustrated when integrating MBUnit, NDoc, Sparx Enterprise Architect, NCover... It seems that somebody at MS said we want to squash these guys like they're worms. Fortunately the uproar made small in flight corrections but at the end of the day the plans are still worm squashing plans. I guess the market will respond!
Comment permalink 2 Milan Negovan |
Mike, yes, I've had this feeling too. I'm curious to see how the industry responds. Although, having unit testing, code coverage and other tools in one package is way cool!
Comment permalink 3 SREEJITH |
My I know Some links to get help to kniow more about unit testing..?

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):