1 Introduction
Non regression tests are needed in all serious project.
They consist to automate units tests by sending them alway the same input data and comparing the output to the expected good one.
2 Unary tests
Each JAVA file should contain a single class.
In all theses class we define a main function that permit to test it without the global context.
Under NETBEANS you select the file you want to test and then you press maj-F6 . Else:
$ java -cp dist/nectar.jar nectar.ConfXml
3 Non regression tests
We need to run the tests under ANT, using externals tools like JDIFF (We decided to use only oriented-java tools).
For now, it is too heavy to import such a tools into the developpement environment (and to stay portable).
It should be something like:
$ java -cp dist/nectar.jar nectar.ConfXml < inputTest1 > outputTest1
$ [ -z "$(diff -q outputTest1 expectedTest1)" ] && echo "test ok" || echo 'test failed'
|