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.