main
action or the applet
action?Ultimately, that decision is left to the person writing the test; however, the following should be considered.
Tests which use the applet
action are not
necessarily restricted to tests which must run in a browser. Any
Swing/AWT code which can be written such that it derives from
java.applet.Applet
or javax.swing.JApplet
is
a potential applet test.
For tests which test graphics functionality, there are three major
advantages to selecting the applet
action over the
main
action: expanded manual
support leading to less
duplicated code per test, thread synchronization, and cleanup.
Frequently, tests which test graphics functionality need some sort of user
interaction to determine whether the test behaves as expected. The
applet
action takes care of providing a user interface which
contains instructions for the user and the appropriate interface to indicate
pass
, fail
, or done
as indicated by the
manual
option. User instructions are taken from the
.html
file referenced in the applet
action. Each
main
action which tests graphics functionality must implement
their own version of this interface. This path leads to more code needed per
test and less consistency across tests in the test suite.
A main
action test is deemed to be completed when the
main
method returns. A test which requires multiple threads must
take care not to allow the main method to return before those other threads
have completed. The applet
action handles basic AWT thread
synchronization.
Finally, the applet
action handles test cleanup. If a test can
not or does not dispose top-level windows or any AWT threads, they will be
eliminated by the harness after the test completes.