Visual Studio: Testing and deployment of files

No comments

When doing unit testing in VS (2008) the default is as follows:

VS copies the compiled and all referenced assemblies to a folder named Testresults in a subfolder called something like:

username_pcname currentdatetime

If you have extra files, like for instance wse3policy.config, you need to tell vs to copy these files to the test folder, or else your tests will fail.

One way of doing it is by adding an attribute [DeploymentItem(path)] to your tests.

This will copy the files to the out folder.

You can also use menu Test -  Edit Test Run configuration and from within there select Deployment and select all the files you need for your tests to run.

But today I found a third option:

Turn off  Deployment.

In the same menu you selected files, you can uncheck the Deployment checkbox, and by doing this disable the entire copy assemblies and related files to a folder I really don't want issue… :)

This saves you the trouble of selecting which files you need for your tests,

it also makes your tests run a bit faster, as you don't have to wait for vs to create folders and copy all files to it for each run.

Be aware that this disables code coverage results, untill you either enable deployment again, or if you go into code coverage you will be told that to do this you need it enabled, and given the option to turn it back on.

Also note that you need to do this pr solution, as MS in their wisdom has made deployment the default, with no way to select a new default afaik.

If you have a lot of tests in your solution there is another option that can help speed things up.

Test Tools menu within Tools - Options, select Test Project and Disable background discovery of test.

This can help things speed along.

rgds

Henri

Posted via email from Henris blogg

No comments :

Post a Comment