On Sun, 21 Sep 2003, Dmitry Diskin wrote:

> Hello All
> 
> I have to design unit tests for large OO application (yes, next time we 
> will create tests before coding). But which is the best way to organize 
> tests?
> 
> In the Test::Unit distribution I saw 't' directory with 'head' scripts 
> (all_tests.t, assert.t) and 'tlib' directory with nested class directories.

That's the perl/CPAN test scripting used during the 
  make;make test;make install
process used for installing perl modules.  They aren't unit tests in the
strict sense, but could be written that way.  I don't use them for
actual unit tests.

Test::Unit is based more on JUnit ideas and is easier to adapt to.

You can get a lot of basic test philosophy from the junit.org site:
http://www.junit.org/index.htm

Here is another good site:
http://www.xprogramming.com/

The downloads page there has links to several Perl test tools.

How you organize your tests depends a lot on what language you're using
and if you intend to include the tests with the product, or exclude them.
In Java, I'll create a top-level tests directory and duplicate the
class tree there, ie:

  tests/foo/bar
  tests/foo/baz
  src/foo/bar
  src/foo/baz

that way when I compile src, the tests aren't written to the classes
path, and the tests are excluded from the final product.

If it's an opensource project, then I use:
  src/foo/bar
  src/foo/bar/tests
  src/foo/baz
  src/foo/baz/tests

and then classes gets the tests and so do the user/developers.

It all just depends on what you need to do with the test code and how
the language works.  There is no one right answer.

PS: I'm only online on the weekends, 'cause I got laid off last year and
resorted to driving trucks for a living because I couldn't get a perl/java
job in Minnesota.

I'm using perl unit these days, using a little front-end of my own and some
customization of runonetest.pl to make it spit out html.  I use mozilla as
my GUI now.  I haven't looked at RUI yet but it sounds interesting.

-- 
Joi Ellis                    
[EMAIL PROTECTED]

No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried.  Anything
that kicks a monopoly in the pants has got to be good for something.
           - Chris Johnson



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Perlunit-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/perlunit-users

Reply via email to