开发者

Using content from the project in tests

开发者 https://www.devze.com 2022-12-28 21:54 出处:网络
I am working with Visual Studio 2010 and it\'s integrated testing functionality. I have an XML file in my project which is set to copy to the output directory.I can access the file just fine when I co

I am working with Visual Studio 2010 and it's integrated testing functionality.

I have an XML file in my project which is set to copy to the output directory. I can access the file just fine when I compile and run the project. But it doesn't exist when I attempt to access it within a TestMethod.

It looks like the test is run with the working directory set to an "Out" directory created within the TestResults directory. I can set a breakpoint before I use the file. If I then copy the file into this "Out" directory and continue running the test it accesses the file properly. But that is not really how I want my automated tests to function.

Is it 开发者_运维知识库possible to tell VS to copy the build directory into this working directory?


I found somewhat of a solution. Though I'm not too happy with it.

Under the Test->Edit Test Settings I edit the current settings. Under the Deployment tab, check the Enable deployment checkbox. In the Additional files and directories to deploy add your bin\Debug directory (looks something like src\LocalModels.test\bin\Debug)

I suppose you could add each file you need and it would be a bit faster. It all seems a bit ridiculous.

0

精彩评论

暂无评论...
验证码 换一张
取 消