users@codemodel.java.net

New developer. Some thoughts on test suite.

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Sun, 19 Nov 2006 14:54:45 +0100

Hi folks.

I have joined the codemodel project since I think the tool is simply
genial. I'll try to take care of the issues that I file myself. I've
filed a couple of things about JAnnotationUse and JAnnotationArrayMember.

Another thing I'd like to discuss is testing. Currently there's a couple
of test classes with main methods there, but they don't perform checks.

What I suggest is testing approach where generated code will be acually
checked against some target files. This is how it works:

1. Code model tests extends some base AbstractCodeModelTest which
prepares and instantiates a code model instance.

2. During the test, some code is generated into say

target/generated-test-sources/mytTestPackage.myTestClass/src

and

target/generated-test-sources/mytTestPackage.myTestClass/resources

These target directories are set up by te abstract base test.

3. After code generation is done, all the generated files are compared
with files from

src/test/generated-test-sources/mytTestPackage.myTestClass/src
src/test/generated-test-sources/mytTestPackage.myTestClass/resources

What do you guys think?

Bye.
/lexi