I have realized how important unit tests are in my development. This is something I learned the hard way after many hours of debugging something that could have been caught in a unit test.
However, I seem to be running into an obstacle when I try to write unit tests with a lot of my work for OpenJUMP. It seems that a lot of my methods deal with GUI components or interaction with GUI components, and that the creation of unit tests for these methods would involved either [1] the creation and intialization of a great deal of JUMP's GUI and supprting classes for a single unit test, or [2] the need to create "mock" objects for the unit test that mimic some aspect of these GUI components involved in the test. (Note that these tests must have the same name as the actual JUMP object and must then by necessity be kept in a separate IDE project . It seems that at some point I run up against the law of diminishing returns. There is so much effort required to dummy up mock objects for the unit test that I might as well let the live execution of the program be the test itseld. It seems like unit tests are cut out for smaller and less GUI involved methods. For example, in my work on the pluggable rendering system for OpenJUMP I have a plug-in that installs a RendererFactoryTool. The initialize() method for that plug-in class obtains an array of child components belonging to the JUMP workbench and then adds a container listener to each of these children that is an instance of the TaskFrame class. Should I be writing a unit test for this method? That is going to involve writing a dummy workbench object and a dummy task frame object. Is this worth the work? I'm looking for some general guidelines on when I should write a unit test for GUI-involved methods. I'm hoping some of the more experience OpenJUMP developers may be able to give me some insight on this. Thanks, The Sunburned Surveyor ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel