David Hayden [MVP C#]

Sponsors

The Lounge

News

  • CodeBetter.Com Home

Other Links

Teas

Patterns & Practices

Florida .NET Developer

Book Reviews

Tampa ASP.NET MVC Developer Group

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Organizing Unit Tests and Projects With Solution Folders

Jeremy has an excellent series of posts about getting started on a new project. He recently talked about organizing unit tests and a number of excellent developers shared their thoughts on how they organize their tests on projects.

One thing I thought may be worth sharing on the subject are "Solution Folders" in Visual Studio. My main reason for mentioning this is based on Phil Haack's recent blog entry, Structuring Unit Test Code, where he mentions the following:

"One convention I use is to prefix my unit test projects with "UnitTest".  Thus the unit tests for Subtext are in the project UnitTests.Subtext.dll.  The main reason for this, besides the obvious fact that it’s a sensible name for a project that contains unit tests, is that for most projects, the unit test assembly would show up on bottom in the Solution Explorer because of alphabetic ordering.

So then I co-found a company whose name starts with the letter V.  Doh!"

Rather than letting the alphabetical nature of the Solution Explorer drive my naming conventions, I will typically toss my tests in a separate Solutions Folder that separates it from the rest of the core code, etc.

 

 

Not only do I get the ability to collapse and expand the folder, but if desired, I also have the wonderful capabilities of hiding the folder completely from view or unloading the projects so they don't participate in compiling.

Hopefully this helps.


Posted Wed, Oct 11 2006 11:20 AM by David Hayden

[Advertisement]

Comments

karl wrote re: Organizing Unit Tests and Projects With Solution Folders
on Wed, Oct 11 2006 1:52 PM

OMG...there are solution folders in VS.NET?!?!...seriously didn't know!

Jim Bolla wrote re: Organizing Unit Tests and Projects With Solution Folders
on Wed, Oct 11 2006 5:25 PM

Whoah sweet. This is a whole different kind of "Daily WTF"... as it "WTF!? I didn't know I could do THAT!"

DotNetKicks.com wrote Organizing Unit Tests and Projects With Solution Folders
on Wed, Oct 11 2006 5:26 PM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Jeff Lynch wrote re: Organizing Unit Tests and Projects With Solution Folders
on Sun, Oct 15 2006 7:45 PM

Great Post!

This is what I call a "blinding flash of the obvious"! In the past eight years, I've never even tried using the Solutions Folders. I wonder how the hell I missed this for so long?

Jeff

John Papa wrote re: Organizing Unit Tests and Projects With Solution Folders
on Mon, Oct 23 2006 8:34 AM

Aren't solution folders wonderful! Such a simple concept yet a great organization feature.