I have a JApplet and I'm trying to think of some way to automate the testing
for it, to make sure that it still behaves properly after I make changes to
it.
The only Java testing tool I know is JUnit but it doesn't really lend itself
to testing applets. It seems to me that a test of an applet needs to have
expected images of what the applet is supposed to look like after each user
interaction: it should then initiate each user interaction and verify that
the actual image of the applet matches the expected image.
Can anyone suggest a tool, preferably freeware, that will do that?
Or is there some other way of testing applets that I haven't considered?

Signature
Rhino
Thomas Weidenfeller - 12 Jan 2006 15:23 GMT
> The only Java testing tool I know is JUnit but it doesn't really lend itself
> to testing applets. It seems to me that a test of an applet needs to have
> expected images of what the applet is supposed to look like after each user
> interaction: it should then initiate each user interaction and verify that
> the actual image of the applet matches the expected image.
So you want to do GUI testing, but ...
> Can anyone suggest a tool, preferably freeware, that will do that?
... there are no really good GUI testing tools. Oh, of course, some work
well for some people, but most people simply give up after some time,
because providing and updating the "known good" data is always a
horrible task, and seldomly pays off.
If you really want to do something like this, then have a look at Java's
Robot class. Or check out things like jfcUnit. Google will reveal more
free tools.
> Or is there some other way of testing applets that I haven't considered?
Not doing it at the GUI level, but only below the surface?
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Andrew McDonagh - 12 Jan 2006 20:13 GMT
> I have a JApplet and I'm trying to think of some way to automate the testing
> for it, to make sure that it still behaves properly after I make changes to
[quoted text clipped - 9 lines]
>
> Or is there some other way of testing applets that I haven't considered?
Depends upon what type of testing you want to do.
Unit tests are only useful for developers as they are written in a
programming language. If this is the type of testing you are after then
yes, JUnit and JFCUnit addon is a great combination.
If its more Acceptance testing you want to perform, as in: does the
applet load into a browser, is it servered by the webserver, does applet
work correctly given its un/signed nature, etc. Then JUnit is not the
tool. More importantly, these tests are written in a domain language
that is more naturally understood by testers and customers, which have
the added benefit of educating the development team about the domain
they are working upon.
Capture and record tools are notorious bad as they tend to be based on
exact co-ords and screen widgets, which tend to change frequently over a
projects life time.
The best tools I've used are (which are ALL free):
Watir (pronounced water): Web Application Testing In Ruby.
http://wtr.rubyforge.org/
Selenium (http://www.openqa.org/selenium/)
uses JavaScript and Iframes to embed a test automation engine in your
browser. There's even a demo you can run in your own browser, which
shows it loading and testing a page.
Demo of Passing Test
http://www.openqa.org/selenium/demo1/TestRunner.html
Demo of Failing Test
http://www.openqa.org/selenium/demo2/TestRunner.html
FIT (http://fit.c2.com/) is a testing framework, which uses HTML files
to specify the tests 'Fixtures' and your 'Fixture Code' to make them
work with your specific application.
Roedy Green - 12 Jan 2006 23:00 GMT
On Thu, 12 Jan 2006 09:41:04 -0500, "Rhino"
<no.offline.contact.please@nospam.com> wrote, quoted or indirectly
quoted someone who said :
>Or is there some other way of testing applets that I haven't considered?
see http://mindprod.com/jgloss/regression.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.