Test project path in Team System 2008
I have a test proj开发者_运维百科ect Company.Test which is located under C:\Dev\Projects\Tests folder When I run a test, I am an xml file under the Tests folder, and I would like to get the path " C:\Dev\Projects\Tests" from the test method. Is there a way to get the current project's folder path?
Please note that the unit tests aren't ran in the project directory. MSTest copies them to a different location and when you don't take special care, your xml file isn't copied to that location. You must configure this explicitly in the MSTest configuration. You can do this byby going to Test / Edit Test Run Configurations / Deployment. You can use the "Add File..." button to add the xml file.
Try System.Environment.CurrentDirectory
.
精彩评论