Noshadow option for nunit-console

I have the following question: what are the advantages and disadvantages of using nunit-console with the / noshadow option? Your comments will be very helpful. Thank you.

+6
nunit
source share
3 answers

The main problem I found with / noshadow is that it stops creating your project, since NUnit is now forced to use and block your DLL. If you leave this option disabled, NUnit will create a copy of your DLL.

If you are trying to practice TDD and constantly build your project in the Red, Green, Refactor cycle, then you cannot easily use / noshadow. An error message will appear:

The process cannot access the file 'bin \ Debug \ calculator.dll' because it is being used by another process.

There are probably ways around this, but the main problem I found.

As for when you will use this: I think the main reason is to speed up the performance, but since the most real unit tests run very fast, I'm not sure when you really need it. I'm sure other people will come up with good examples.

+4
source share

If you have to rely on anything that uses the file location in your tests, tell me for some kind of curious process of loading the assembly, or just as simple as Assembly.GetExecutingAssembly (). Location, then you are likely to run into problems, NUnit copied your file to a location other than the build location.

I would say that usually these problems can be avoided, especially if you do not touch the file system in your unit tests.

+4
source share

A quick warning, the gradle plugin for Nunit has changed the way you set shadow parameters. It took a while to find this, so post here if it can help someone else.

noShadow is replaced by shadowCopy, and the default is false, i.e. the name has changed, but the meaning / direction is the other way around. This was done, apparently, to more closely match what Nunit 3 does. You can read the information about this in the plugin change log at https://github.com/Ullink/gradle-nunit-plugin/blob/master/ CHANGELOG.md

0
source share

All Articles