Issues in Testing Java Applets
Jan Newmarch
University of Canberra
Testing
- Improve quality
- Reduce bugs
- Logic errors
- Environmental errors
Environmental errors
- Test on every platform
- Java Virtual Machine is one platform?
- Single specification
- Multiple vendors
- Multiple platforms
Applet vs Application
- Application is standalone
- Applet runs within a browser
- Environment supplied to the browser varies
- Environment supplied by the browser varies
Applet test policy
- Test in every browser on every platform
Test harness
- Can do unit, integration, system and acceptance testing
- Applet testing is at the system level
- Typical method would be to simulate user interaction
- Test harness needs to run within the browser, so must
be an applet (probably not a plugin)
- Test harness must be an applet container
Test language
- Scripting languages are common
- Language needs to be interpreted by the test harness,
which is an applet
- Language could be Java or tcl (via JACL)
or any language with a Java interpreter
Test script location
- Locate test scripts with browser?
- distribution problem
- may not get local access to file system
- Locate test script with applet, to be uploaded
to the browser
Security
- Applets run in a sandbox
-
ClassLoader
access restricted
- Event queue access restricted
GUI elements
- GUI toolkits are the AWT and Swing
- Event types are input and semantic
- AWT:
- Can't fake input events
- Faking semantic events puts widgets out of sync
- Swing:
- Can fake input events
- No need to fake semantic events
Events versus Actions
- Events may need (x,y) coords which may be fragile
- Some widgets may support higher-level actions (such as
doClick()
for JButton
)
- Problem: Swing
JFileChooser
has components
such as an OK
button
- location of button cannot be determined at runtime
- no action exists to drive the button
- Swing has insufficient support for either method
Test harness
-
replayJava
is under development to test
Java applications
- only designed for Swing elements
- scripts written in
tcl
- can generate events for Swing objects
- can call actions on Swing objects
- being adapted to applets
Problems
- (x,y) coords need to be guessed for some widgets
- incomplete set of actions for some widgets
- limited event queue access
- no standard for applet containers
Conclusion
- Testing applets should be done on every browser
on every platform
- Test scripts should be with the applet
- A scripting language such as
tcl
can be used by a test harness
- The test harness should be an applet
- AWT components are too hard to test, but Swing
components should be ok
- Problems still remain
Jan Newmarch (http://pandonia.canberra.edu.au)
jan@ise.canberra.edu.au
Last modified: Mon Apr 13 21:36:11 EST 1998
Copyright ©Jan Newmarch