Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Noshadow option for nunit-console

Tags:

nunit

I have following question : what are advantages and disadvantages in running nunit-console with /noshadow option? Your comments will be very helpful Thanks

like image 540
lm. Avatar asked Jan 05 '10 21:01

lm.


2 Answers

The main issue I've found with /noshadow is that it stops your project from building as NUnit is now forced to use and lock your DLL. If you leave this option disabled, then NUnit creates a copy of your DLL.

If you are trying to practice TDD and are constantly building the project in the Red, Green, Refactor cycle, then you can't easily use /noshadow. You will get an error message like:

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 that's the main problem I've found.

As for when you would use this: I think the main reason is to speed up performance, but as most true unit tests run really quickly, I'm not sure when you would really need this. I'm sure other people will come up with some good examples.

like image 178
Paddyslacker Avatar answered Oct 14 '22 15:10

Paddyslacker


If you happen to rely on anything that uses a file location in your tests, say for some curious assembly loading process, or just something as simple as Assembly.GetExecutingAssembly().Location, then you're likely to hit problems because NUnit has copied your file to some other location than the build location.

I'd say that typically these problems can be avoided though -- especially if you avoid touching the filesystem in your unit tests.

like image 30
Tim Barrass Avatar answered Oct 14 '22 15:10

Tim Barrass