advice on SUnit Tests please

Thomas Koenig tomkoenig at mindspring.com
Sat Apr 16 22:31:59 UTC 2005



Herbert König
> But this seems a lot of work while testing the UI manually 
> seems simple.
> 
> So please provide some opinions or pointers how to assess if 
> or why or in which situations it is still wise to go through the work.
Yes if you are doing production work it is worth while because anything
worth coding is worth having automated tests for. And yes it is very
hard, so you want design your system so that as much code as possible
can be tested without relying on the GUI sunit tests.  But that’s just
good, if hard to follow, advice anyway.

For examples of excellent GUI driven xunit tests install Monticello or
Omnibrowser.  I based my BFAV tests on these models.
 
> And after my recent experience (see my other posting) I'm not 
> quite so sure if it is really wise to write the tests first. 
> Or is it just that people think that the tests never get 
> written if they aren't written in advance?
TDD development is a craft.  It's hard to learn.  I would expect many of
your early attempts to fail. Work the execises in Beck's book on TDD and
Astels "Trivia Game Project."  You will get better.  Like most XP
practices, it requires being realistic about your capabilities: almost
always, folks try to be too ambitious with their first efforts.
Finally, gui xunit testing is not the place to start, but you can get
there.
> 
> Actually it was the first time I really wrote the test before 
> the method that it didn't work out well.
> 
> Again any pointers or opinions are welcome and I will not be 
> annoyed if someone says "You'd just be a fool not to do it in 
> advance".
The best reason to write the tests first, is that that’s the easiest way
to write the tests.  The "testablity" of a system is one aspect of its
design.  If you write the test first you system will be testable by
design.  It's fine to program without tests, just like its fun to go for
a drive without a map.  But you want to learn how to do it.
> 
> 
> Best regards,
> 
> Herbert                          mailto:herbertkoenig at gmx.net
> 
> 




More information about the Squeak-dev mailing list