TFS, testing and placement of test files (where)

I am currently experimenting with TFS and I really like it.
One small question regarding test files:

I have a directory with some demo TXTs, images, dirs ... They are used during tests, so until now the path has been hardcoded to a folder on my computer. Now I need to change this, of course, TFS also needs file access.

My idea was to put them in the folder of my solution, currently I have something like this:

  • Solutions folder
    • mysol.sln
    • Someprojectdir
    • OtherProjectDir
    • _LIB for external .dll
    • _DEMO_FILES for test files

The entire solution folder is under source control. Would you do it the same way? What is the best and most elegant way to get a “real” folder path for use in unit tests? Using the execution path, cut the rest? Do I use test files under source control?

Thanks for any input,
Chris.

EDIT: Aside from the hint given in the answer, keep in mind that when testing there are some pitfalls with this. The test is performed in another folder (often called after some time code), test files are not automatically copied there. Even if they are always set to copy.

, , DeploymentItem , , , Local.testsettings . , , .

, , . DeploymentItem google

+3
1

, . , , , , , , , . , Visual Studio.

Embedded Resource, , . - , ( VS), .

+4

Source: https://habr.com/ru/post/1750465/


All Articles