chugh97
chugh97

Reputation: 9984

Test project path in Team System 2008

I have a test project 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?

Upvotes: 0

Views: 137

Answers (2)

Gerrie Schenck
Gerrie Schenck

Reputation: 22368

Try System.Environment.CurrentDirectory.

Upvotes: 1

Steven
Steven

Reputation: 172676

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.

Upvotes: 2

Related Questions