Posted by
Sami Badawi-2 on
Feb 14, 2008; 4:11am
URL: http://imagej.273.s1.nabble.com/Validation-tp3697192p3697194.html
Konstantin,
The part of the software industry that need reliable results, e.g. finance,
is moving towards extensive use of unit tests, and often test driven
development.
You don't add new code without new unit tests and you don't check in code
without running all unit tests.
In my little ImageJ project ShapeLogic, I currently have 320 unit tests.
It takes a lot of work to add unit tests, but yo get
* Reliability
* Speed of making changes and bug fixes
* Ability to refactor code easily
* Unit tests serves as documentation of codes intentions
I could not imagine working without it anymore.
The code that is not dependent of ImageJ is tested isolated, that is simpler
and faster.
This is how I test the plugins that I have written in ImageJ.
public ByteProcessor runPluginFilterOnImage(String fileName, PlugInFilter
plugInFilter) {
Opener opener = new Opener();
ImagePlus image = opener.openImage(fileName);
ByteProcessor bp = (ByteProcessor) image.getProcessor();
plugInFilter.setup("", image);
plugInFilter.run(bp);
return bp;
}
During development or debugging I run individual unit tests from Eclipse.
When I am checking code into Subversion I run all test from command line
using Maven 2:
mvn test
Hope this is helpful,
-Sami Badawi
http://www.shapelogic.org