I’ve found a useful post recently in here: NUnit extension
However my question is still not answered.
First of all, what is a ‘test assembly‘ anyway?
Second, could someone give me a more detailed explanation of ‘NUnit searches each test assembly for addins to be loaded‘?
For example, I have two projects in my VS2010 solution, say, project A and project B. A is a test project(contains ‘[Test]’ inside), B is an NUnit addin project(contains addin installer, EventListener interface implementations, etc. inside), and, A references B. Does this work? Will the addin be called?
If not, I assume it means that I must have the various .cs files(which implements the NUnit addin) directly included in project A, rather than have them placed into a separate project and reference it in test project. Is that what you mean?
If so, another problem raised, that, when I have project C, D, E… which are also test projects, I have to include those various .cs files(which implements the NUnit addin) in each test project?
This is the answer Charlie provided on google groups. Many thanks to Charlie!
https://groups.google.com/forum/?fromgroups#!topic/nunit-discuss/yTKRKf2APLI
Re: [nunit-discuss] Re: NUnit extension
On Mon, May 21, 2012 at 8:13 AM, Athrun Sun wrote:
In that situation, no. B is not a test assembly.
Exactly
This feature is provided to allow testing of extensions under
development, so it’s not really a problem with needing to use the
extension in multiple assemblies. In fact, if you were to duplicate
the code in two assemblies, I imagine NUnit would try to register two
different addins, with potentially surprising results. 🙂
For production use, you should install the addin in the addins folder
in the normal way. In addition, it’s best not to reference the addin
assembly from your code. Although this may not always cause a problem,
it sometimes does lead to the addin being loaded twice.
Charlie
– show quoted text –