Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

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.

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

4 Responses to Organizing Unit Tests and Projects With Solution Folders

  1. johnpapa says:

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

  2. jlynch says:

    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?


  3. jimbolla says:

    Whoah sweet. This is a whole different kind of “Daily WTF”… as it “WTF!? I didn’t know I could do THAT!”

  4. karl says:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>