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

Reply via email to