Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Files setup for deployment in TestSettings are not deployed
Henriksen
#1 Posted : Wednesday, January 25, 2012 9:57:54 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/25/2012(UTC)
Posts: 1
Location: Stavanger, Norway

We have some files that need to be in the current directory when running the tests, among others the nihbernate.cfg.xml file.

We're using MSTest so what we've done is setting up deployment in the Test->Edit Test Settings -> Local (test.testsettings) and under the "Deployment" sheet, we've added the relevant files.

When using MS test runner or the ReSharper runner the files are deployed to (Solution)\TestResult\user_workspace 2012-01-25 10_46_59\Out (when using MS test runner or (Project)\bin\Debug\TestResult\user_workspace 2012-01-25 10_46_59\Out (when using the ReSharper test runner)

Those directories are also the current directory when using the respective test runners.

When running tests in NCrunch the current directory is C:\Users\user\AppData\Local\NCrunch\12884\98\TestResults\1a6f5bbd-85f2-4122-a27c-abb7065286a5\Out but the files specified for deployment in the Test settings are not there.

It would be preferable that NCrunch made sure to copy the relevant files from the Test Settings but in the meantime, how can I make sure that the relevant files are copied into the Out directory?
Remco
#2 Posted : Wednesday, January 25, 2012 8:46:15 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
NCrunch doesn't support the use of MSTest deployment resources through the testsettings file, so no files that you specify here will be copied into the testing workspace (as you've described). There are two ways you can work around this:

1. Declare the files to be copied by using the DeploymentItem attribute on your tests, instead of in the config file (as NCrunch does support this)

2. Reference the files in their original location within your solution, using relative paths. Provided you have included the files within the NCrunch workspace using a .proj file, or using the 'AdditionalFilesToInclude' NCrunch config setting, the files should exist underneath the NCrunch workspace (which in your case is at C:\Users\user\AppData\Local\NCrunch\12884\98\). NCrunch will always store the files with the same relative path as they would be within your normal solution, so you can access them by referencing upwards from your test 'Out' directory ... for example: ..\..\..\ResourceFiles\myfile.txt. If your code is fully dependent on the files existing within the 'Out' directory, you could rig up an extra step in the test to copy the files there.

I hope this helps.


Cheers,

Remco
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.026 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download