Re: Test driven design and graphics in Java
On Fri, 18 Apr 2008 13:37:47 -0700, Daniel Pitts wrote:
[Snip]
In other words, don't test "User Clicks Button". test "Event Fired When
User Clicks Button"
[Snip]
I understand all this, but I'm really working on a graphical
application. The problem isn't really to test whether a single event is
fired. The problem is to determine if an image has been altered
correctly when a certain sequence of events happen... or something
similar.
I was using the methodology you recommend, testing to see if the event
was fired, or the equivalent, checking to see if the correct calls to the
graphics object were made, but this turned into a nightmare. Small
changes to the code lead to great changes to the calls to the Graphics
object. So the testing is very brittle.
I think the best I can do is provide before and after images and see if
the tests produce what is expected. Unfortunately, this really means
that the tests cannot be developed before the code is written since the
code must be used to do the image processing. This will probably still
work for future changes, to make sure that I'm not breaking code, but it
won't help for directing development.
--
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>