OK - Stupid NUnit question

  • Thread starter Thread starter George
  • Start date Start date
G

George

All,

Ok I am reading through all this NUnit stuff and using it to unit
test .Net applications. My first question which I have not seen an
answer to yet is:

Are we supposed to put all the NUnit methods in the actual
application we are testing or is the theory that your NUnit testing is
a separate .Net application that call methods / functions etc in the
actual code we wish to test? Additionally, any GOOD documentation you
can point me towards with regard to getting started (an not installing
the software etc but actually using it to test a real .Net
application) would be appreciated.


Thanks
George
 
George said:
All,

Ok I am reading through all this NUnit stuff and using it to unit
test .Net applications. My first question which I have not seen an
answer to yet is:

Are we supposed to put all the NUnit methods in the actual
application we are testing or is the theory that your NUnit testing is
a separate .Net application that call methods / functions etc in the
actual code we wish to test?

Seperate application.

Additionally, any GOOD documentation you
can point me towards with regard to getting started (an not installing
the software etc but actually using it to test a real .Net
application) would be appreciated.

Check this:
http://cit.wta.swin.edu.au/cit/subjects/CITP0020/topics/topic4_nunit/011.NUnit_Dummies_Guide.html
 
You'll probably get a lot of opinions on both sides of this issue. I
(and my team) personally don't like having the tests in the same DLL as
the code it is testing, but that's just us. I've met developers that
like to have them in the same DLL so they don't have to manage the extra
DLL. The only thing I'll say on this is that if you do put your tests
in the same DLL as the code it tests don't forget to put #IF DEBUG
pragma checks around the test code or sooner or later you will have a
hacker (or even a well intentioned junior developer) that will use
reflection to call the test routine that clears out your database :-(
This is one of the reasons why my team uses a separate DLL.

If you want a resource that can help you get a handle on this, check out

http://www.pragmaticprogrammer.com/starter_kit/ut/index.html

These books are gold for figuring out a number of items related to good
development habits.

Have A Better One!

John M Deal, MCP
Necessity Software
 
Hello George,

Theoretically, you can place your test cases in with your application code.
However, in practice, this is probably not the best idea.

The best documentation Ive found for NUnit is <a href="http://www.amazon.com/exec/obidos/ASIN/0735619484/mattbertherco-20">Test-Driven
Development in Microsoft.NET</a> by James Newkirk (one of the authors of
NUnit).

Another one, if you're looking at how/what to test is <a href="http://www.amazon.com/exec/obidos/ASIN/0974514020/mattbertherco-20">Pragmatic
Unit Testing in C# with NUnit (Pragmatic Programmers)</a> by the Pragmatic
group.

Hope this helps...
 
Back
Top