Well this one was pretty nasty I must admit.I didn’t know that I would lose some time on this one.And since I did I might as well blog about it.So here goes the problem statement.Have you faced the scenario wherein you had to copy some files under some folder in Unit tests in Visual Studio? This is because the test cases run under a folder called test results and each time you run it creates a new folder for that particular test case. Mind you before I start I must say that I have encountered this on the VS-2010 and not on the nascent versions of Visual Studio viz 2012.So here goes as to what you need to do to achieve the same.
1)First go the TestSettings file in VS 2010 which is directly under solution.
2)Go to Deployment section and check Enable deployment and add the directory that you want to add.
3)Now is the trick part you have to edit the Test Settings file in Xml editor and go the tag under Deployment which has the required DeploymentItem and the attribute outputDirectory as follows.
4)Finally the worst part was now when you run the unit tests you will still now find it added.So to get it in working in VS 2010 you have to select the test list editor under the Test–>Windows menu in Visual Studio IDE.And then select your tests and hit run.Eureka… ooo still not there yet.The directory or file is still not out there!
5)Close your Visual Studio IDE and open it once again.(Age old trick works in the realm of WINDOWS).
So happy testing once again 🙂