[I think the comment about addressing JUnit with these thoughts rather than the
Cactus list is a valid one].

But as the thread persists (!) I agree that you don't want to remove the
'thought' behind generating tests. But I'd like to be able to tie the tests
more closely to the code being tested. Perhaps tag the code to be tested with
appropriate test data/sets etc. At the moment (and I have limited experience of
JUnit and Cactus) I have a TestCase class separate from the classes I'm
testing.

The point below about the test cases acting as an example of how to use the
code is a reasonable one.

But beyond that I haven't given this any thought. It would definitely require
some in-depth consideration.

 --- Jari Worsley <[EMAIL PROTECTED]> wrote: > Karthik Kumar
wrote:
> > 
> > Hello,
> > 
> > --- Brian Agnew <[EMAIL PROTECTED]> wrote:
> > > I was thinkking on a similar line, but thought of the following:
> > >
> > > Use custom Javadoc tags for each method, indicating testability,
> parameters,
> > > expected results, messages etc. We then have a custom Javadoc doclet.
> When we
> > > want a TestCase we run Javadoc with the custom doclet over the code and
> > > create
> > > the test cases automatically.
> > >
> > > This can be made part of the build. The test parameters etc. are tied
> > > directly
> > > to the code, so it's pretty obvious what's going on.
> > >
> > > Brian
> >   Using custom javadoc tags seems a great idea. Because that would give a
> great
> > control to the programmer over the code he writes the same way he writes
> doc.
> > for his code.
> 
> I'm not sure about automating the writing of tests - provide a framework
> for getting data out of a file if you have many tests to run (which
> sounds a bit like an functional or integration test to me?). Have a look
> at jxunit on sourceforge, or perhaps the latka project in
> jakarta-commons too.
> 
> I wouldn't be amazingly keen on using custom tags to create the tests -
> it means you lose some of the point of writing unit tests in the first
> place, namely that the test then acts as an example of how to use the
> tested class.
> - i.e. with a class Broker and test of TestBroker, the code in
> TestBroker provides any programmer who wants to use Broker with actual
> code examples of how to use the API. If you use tags you would lose that
> advantage.
> - also, i think you need to be careful about how "easy" or "automated"
> you make writing tests, otherwise you're in danger of losing another of
> the main points about them - by being made to think about each
> individual test of a class, you learn more about the class that you are
> writing. So it shouldn't be a "chore" to write tests, but more a regular
> feature of how you work during the day, to make your job easier :)
> 
> ( or do you just use the javadoc tags to generate TestCases, then flesh
> out the generated code if need be?)
> 
> 
> 
> Jari
> --
> Jari Worsley
> Senior Programmer
> Hyperlink Interactive Ltd 

=====
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         [EMAIL PROTECTED]
+44 (0)7720 397526

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

Reply via email to