views:

375

answers:

2

We have a Web Application Project (dozens actually..) that has a testing project attached to it. In the testing project I have a simple unit test which exercises a couple of methods.

Running locally, the unit test executes and works.

However, when our TFS Build server attempts to execute the test, it fails with a error about an invalid path for the AspNetDevelopmentServerHost attribute. Other team members can execute it just fine.

The problem is that the root of my TFS Workspace is set to c:\projects\ One of the team members has theirs set to c:\tfs2008\ The TFS Build server on the other hand sets the pathToWebRoot variable to "c:\blahblah\Release_PublishedWebsites..." Which results in a bad path.

Due to the number of projects we have, I can't have everyone reset an environment variable every time they switch projects.

So, what are the best practices with regards to unit testing web projects in a team environment? The MSDN site article was in true microsoft fashion less than helpful.

+1  A: 

you should specify the string %pathtowebroot%\\WebSiteName in the ,pathToWebApp parameter of the AspNetDevelopmentServer or AspNetDevelopmentServerHost attribute.

Tom
Close enough. I just wish we could have set it at run time..
Chris Lively
+1  A: 

It's possible to set environment variables during the build to alter the path and still have it work in a local environment.

  • http://msdn.microsoft.com/en-us/library/ms184806.aspx
  • http://msdn.microsoft.com/en-us/library/ms243136(VS.80).aspx
JKG
After much research, the real problem is that the PathToWebRoot is incorrectly set in TFS Build for web projects. Web Sites work just fine, but it doesn't set it correctly for web projects which have a different output path. Incidentally, I gave up on this in the hopes that 2010 fixes the problem.
Chris Lively