As I mentioned last week, I am new to TDD. For better or worse, all of my tests (and spikes) have been generated via Visual Studio Test Projects. Working with VS Test Projects hasn’t been all that bad although I noticed a couple of annoyances right away.
Is anyone else bothered by the fact that, by default, an unlimited number of test results and binaries are “deployed?” If you are testing first, this arguably makes for a lot of useless activity and waste disk space. Since the default TestResults folder location is set to be side-by-side with your solution files, the extra folders, trx files and binaries can also really interfere with your otherwise easy source control check-ins.
Fortunately, there are ways to work around the excessive TestResults problem if you are running VS2008. Some options are available through the IDE and other require an update to the .testrunconfig file directly:
Limit the number of deployed tests:
Tools > Options > Test Tools > Test Execution > Test Results Management > Limit number of old Test Results to the value of your choosing.
The screen shot below sets the number of tests to one. Therefore all previous tests are purged and only the latest test is maintained.
Disable Test Result deployment:
If you wish to disable the Test Result generation completely, double-click on your solution’s .testrunconfig file and uncheck the “Enable deployment” option. No results will be generated thereafter.
Change the Test Result folder location:
This option is hidden. I don’t believe it is exposed in any of the VS 2008 dialogues and you have to edit the .testrunconfig file directly.
Right-click on the .testrunconfig file > Open With… > XML Editor > Include the following within the TestRunConfiguration node:
<Deployment useDefaultDeploymentRoot="false" userDeploymentRoot="C:\TestResults" />
I hope it helps.
References:
- http://arcware.net/archive/2007/12/09/Limit-the-Number-of-Old-Test-Results-with-VS2008.aspx
- http://blogs.msdn.com/nnaderi/archive/2007/05/11/new-unit-testing-features-in-orcas-part-1.aspx
- http://weblogs.asp.net/stephenwalther/archive/2008/03/19/tdd-test-driven-development-with-visual-studio-2008-unit-tests.aspx
- http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3026907&SiteID=1
Thanks for these tips – these issues were driving me crazy! Cheers!
Thanks for the info on how to change the TestResults folder! That is exactly what I was looking for.
Can I use “relative path“ on userDeploymentRoot element?
I have a Blogger blog that is hooked up to my personal website. The actual blog is linked off of the homepage. I would like to know if there’s a widget or something that I can put on my website’s homepage that will show my latest blog posts. Not the whole post, but maybe just the headline and a link to go to my blog..
Hey! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be bookmarking and checking back often!
I’d must grant with you on this. Which can be not one thing I usually do!
Everything is very open with a clear explanation of the issues. It was really informative. Your site is extremely helpful. Thanks for sharing!