Monday, July 13, 2009

Visual Studio Class Library Configuration for Unit Testing

This is the best practice configuration used by The Nature Conservancy’s TIS Conservation Team for setting up a Visual Studio source code class library and accompanying unit test class library.  The Conservation Team is currently using NUnit 2.5 and Rhino Mocks 3.5.

Here is the physical layout of the folders including the key files that are managed by Subversion:

Folder_Layout

My Unit Test Project

  • Docs:  standard TNC practice to include an INSTALL.txt document with every project inside of the Docs folder.  Contains basic instructions on how to add the unit test class library to a Visual Studio solution.
  • UnitTestCode:  this folder contains all of the unit test C# (or VB) class files, the VS project file (.csproj) and the NUnit GUI Runner project (.nunit and .VisualState.xml) files
  • IGNORES.txt: SubVersion ignore property list
  • Readme.txt:  standard TNC practice to include a Readme file with summary, prerequisite, and other basic information pertaining to the unit test class library

The IGNORES.txt file looks like this:

Bin
bin
Obj
obj
TestResult.xml

My Source Code Project

  • Docs:  standard TNC practice to include an INSTALL.txt document with every project inside of the Docs folder.  Contains basic instructions on how to add the source code class library to a Visual Studio solution.
  • SourceCode:  this folder contains all of the source code C# (or VB) class files and the VS project file (.csproj)
  • IGNORES.txt: SubVersion ignore property list
  • Readme.txt:  standard TNC practice to include a Readme file with summary, prerequisite, and other basic information pertaining to the source code class library
  • version.txt:  standard TNC practice to include a version number

The IGNORES.txt file looks like this:

*.aps
*.bak
*.bpt
*.bro
*.bsc
*.cdb
*.class
*.dep
*.dpd
*.err
*.exe
*.exp
*.gid
*.gz
*.hlp
*.hm
*.idb
*.ilk
*.jar
*.lnk
*.log
*.ncb
*.obj
*.ocx
*.opt
*.pch
*.pdb
*.ph
*.pjt
*.plg
*.res
*.sav
*.sbr
*.scc
*.suo
*.tar
*.tlh
*.tli
*.trg
*.vtg
*.ww
*.zip
Bin
bin
Obj
obj

No comments:

Post a Comment