high-level semantics for Java apps?
I'm a Java developer considering RobotJ for unit testing SWT
applications. I'd like to know, does it support component-level
semantics? by which I mean:
I don't know much about RobotJ; I've only read the whitepaper
esp its code listings. In them I see statements, e.g.
which concern me in two ways:
* coordinate references
* names that look generated
I'm hoping these are artifacts of the web-testing scenario which
Arnold describes. (Esp the generated names, which would be necessary
in a web scenario if the source code was not available.) Is that the
case, or does this persist even if testing a (local, J2SE) Java app?
Why I'm concerned:
Unlike RobotJ (or Rational Robot, about which I also know even less),
I do know something about several packages which build additional
functionality on java.awt.Robot, esp Abbot
Both of these have components which encapsulate code lookup, which
allows one to write code without coordinates or "magic" names, like
+ ArrowButton arrow = new ArrowButton(ArrowButton.LEFT);
This is good, because:
* layouts tend to change over time
* layout dimensions can/will differ between platforms (e.g. Windows vs
KDE on Linuxen vs Motif on Solaris)
* non-coordinate semantics make test-first development (TDD) possible.
This is good, because writing a test forces one to think more
specifically about the functionality intended, and because tests are
more likely to be maintained than documentation.
* code can only be refactored (easily) if names are consistent between
testing code (code implementing tests) and source code (the code
</sermon> What is BAD about these packages is that they currently only
support AWT, and I'm working on an Eclipse plugin (i.e. SWT). Hence my
interest in RobotJ.
Re: high-level semantics for Java apps?
All good reasons; but believe me RobotJ tends to beat them all
Al though RobotJ names the objects it records with some custom names, it sure is for a reason. It creates a transparent map to help the tester look for the actual Object properties.
Reg. your concern about the name and co-ordinates, it is not a concern for RobotJ. RobotJ identifies the object to record by taking some important object recognition properties like .classid, .name, .text, etc. The cool thing is that if a perfect match is not found, RobotJ finds a nearest match and logs a warning.
I hope this answers your questions/concerns