Em Seg, 2002-09-23 às 23:57, Andreas Schaefer @ Home escreveu:

> So I came up with the idea to implement a XDoclet
> JUnit module allowing a user to use class/method
> JavaDocs to use to specify the TestCase classes.

My idea is that we shouldn't use javadocs to write code. Better
explaining: I think that unit tests shouldn't be generated. These tests
prove the rightness of your application, and there *must* be some human
intelligence behind its writing.

However, I see that there *is* space for some test generation, but the
most simplistic one: constant input, expected output. Something like
this:

/**
 * My very complex method.
 *
 * @junit.test input="2, 3" expect="6"
 * @junit.test input="2, -1" expect="-2"
 * @junit.test input="1, 0" expect="0"
 *
 */
public int multiply(int x, int y)
{
    return x * y;
}


My idea is that we could generate tests that checks if the method
behaves correctly for different input data. I don't think we should
generate any tests more elaborate than this. Throw in some ideas if you
think I'm wrong!

> The class JavaDoc would contain the
> setUp(), tearDown() methods.

Write java code in comments? No way. setUp() and tearDown() methods
could be specified in a superclass. Or the generated test case could be
abstract and you have to subclass it to provide these methods.

-- 
Pazu <[EMAIL PROTECTED]>

Anime Gaiden - de fãs para fãs, sempre.
http://www.animegaiden.com.br

Attachment: signature.asc
Description: PGP signature

Reply via email to