Playing Chicken With Common Sense

Subversion is awesome

I am a big fan of source control and subversion is my favorite.  I used it for several years before being forced into using TFS on my current project.  Subversion is great because it really doesn’t get in your way.  You hardly notice the code is under source control.  On the other hand, Team Foundation Server (TFS) is always in your face with prompts and agitates you by forcing you to understand it rather than it understanding you.

TFS Sucks

Case in point, a few months back I was creating the normal unit tests for the software being developed.  I added Castle Windsor to the solution and I wanted to use the windsor.config file with my unit tests because the values inside it needed to be validated.  I usually just put the config values in the unit test setup method but this set of tests needed to validate the windsor.config file itself.  So I created a soft copy of the .config file giving the unit test project access to it.  Then I created my unit test method telling it to open the config and read the values I needed.  I kicked off resharper test and it failed.  I was a little miffed…  This wasn’t even a hard test so why was it failing.  I thought for sure it would work first time since I had already ran the code the unit test was running in snippet compiler.  I checked the code and it was fine so I ran it in debug mode and found that the windsor.config file was missing.

Confused

I was a little confused since it was sitting right there in the solution.  I checked my bin folder to see if it was output and then I remembered that the unit tests don’t use the bin folder so I checked the test folder to see what files it had in it.  Lo and behold the windsor.config file is missing – doesn’t exist – the test doesn’t have it.  So I go to every developers best friend (google) and search for an answer.  After hours of searching I finally found what I needed to know.  Which is the reason for this post in the first place.  I just had to tell you how much I hate TFS and Microsoft’s backwards ass thinking when it comes to source control.  Visual SourceSafe was a pile of steaming crap and as if they couldn’t learn their lesson with it they had to continue their dumbass ways with TFS.  This is not a problem in subversion.  It just works – no problems what so ever.  A free product developed by a very few people beats the pants off Microsoft again.  We see it time and time again.  About the only thing Microsoft has left worth a damn is Visual Studio.

Answer

The solution to my problem was an attribute called DeploymentItem which gets applied to my test method.

   1: [TestMethod]
   2: [DeploymentItem("windsor.config")]
   3: public void ValidateConfigDataTest()
   4: {
   5: ...
   6: }

It took me several hours to find this little nugget of gold and hopefully you arrived here quickly enough.  I searched for tfs unit test config deploy read load missing and about a hundred other incorrect things until I stumbled upon the answer.

Here are a few links I found:

http://tinyurl.com/latn5u

http://tinyurl.com/ljoxuo

http://tinyurl.com/lrxomo

http://tinyurl.com/ovqhmu

  • 1 Comments
  • E-mail
  • Kick it!
  • Shout it
  • Bookmark and Share

Comments

adnan adnan   United States 6/29/2009 9:37:42 AM #

TFS is truly an annoyance. Since I have been using TFS on a project I am not confident of my source anymore. I have had cases of lost files and code and many troubles checking out and checking in.

Subversion rules, wonder why someone would not use it, is FREE and works great!

Control panel

RecentComments

Comment RSS