public abstract class BaseTest
extends java.applet.Applet
Planned features include:
Copyright © 1997, 1998
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.5 $
java.applet.Applet.AccessibleApplet
Modifier and Type | Field and Description |
---|---|
protected java.io.PrintWriter |
out
The PrintWriter to which delayed output is sent.
|
protected java.io.PrintWriter |
status
The PrintWriter to which immediate output is sent.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseTest()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected void |
commandline(java.lang.String[] args)
Used to run a test from the command line.
|
protected void |
commandline(java.lang.String[] args,
int offset)
Used to run a test from the command line, skipping the first offset
arguments (which are assumed to have been processed by the subclass).
|
java.lang.String |
describeOptions()
Describes the command-line options of this class.
|
java.lang.String |
describeUsage()
Describes the command-line usage of this class.
|
protected abstract void |
engineTest()
This method should be overridden by test subclasses, to perform the
actual testing.
|
protected void |
error(java.lang.Exception e)
Reports an error due to an unexpected exception.
|
protected void |
error(java.lang.String msg)
Reports an error, with the given message.
|
protected void |
error(java.lang.Throwable e) |
protected void |
fail(java.lang.String msg)
Reports a failure, with the given message.
|
int |
getErrors()
Returns the number of errors so far.
|
int |
getExpectedPasses()
Returns the number of expected passes, or 0 if this has not yet been
set, or is unknown.
|
int |
getFailures()
Returns the number of failures so far.
|
java.lang.String |
getName()
Gets the name of this test (as shown to the user).
|
int |
getPasses()
Returns the number of passes so far.
|
int |
getSkipped()
Returns the number of skipped tests so far.
|
void |
init()
Used when the test is running as an Applet.
|
boolean |
isGuiEnabled()
Returns true iff a GUI interface is being used.
|
boolean |
isOverallPass()
Returns true iff all the tests have completed successfully.
|
boolean |
isVerbose()
Returns true iff output is to be printed even if all tests pass.
|
protected void |
parseOption(java.lang.String option)
Parses a command-line option.
|
void |
parseOptions(java.lang.String[] args,
int offset)
Processes command-line arguments from args, starting at index
offset.
|
protected void |
pass(java.lang.String msg)
Reports a pass, with the given message.
|
protected void |
passIf(boolean pass,
java.lang.String msg)
Reports a pass if pass is true, or a failure if it is false.
|
protected void |
report()
Forces a report of the number of passes, failures, errors, and expected
passes so far.
|
protected void |
setExpectedPasses(int n)
Sets the number of expected passes for this test class.
|
void |
setGuiEnabled(boolean flag)
Sets whether a GUI interface is used.
|
void |
setName(java.lang.String n)
Sets the name of this test (as shown to the user).
|
void |
setOutput(java.io.PrintWriter pw)
Sets the PrintWriter to which output is to be sent.
|
void |
setVerbose(boolean flag)
Sets whether output is to be printed even if all tests pass.
|
protected void |
skip(java.lang.String msg)
Reports a skipped test, with the given message.
|
void |
test()
Begins the test proper.
|
void |
waitForExit()
Blocks until it is time to exit.
|
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected java.io.PrintWriter status
protected java.io.PrintWriter out
public void init()
init
in class java.applet.Applet
public void setGuiEnabled(boolean flag)
public boolean isGuiEnabled()
public void waitForExit()
protected void commandline(java.lang.String[] args)
commandline
method on it, passing the array of command line arguments. For example,
in class TestFoo:
public static void main(String[] args) { new TestFoo().commandline(args); }
protected void commandline(java.lang.String[] args, int offset)
protected void parseOption(java.lang.String option) throws TestException
super.parseOption(option)
should be called.
Case should generally not be significant in option names.
TestException
public void parseOptions(java.lang.String[] args, int offset) throws TestException
TestException
public java.lang.String describeUsage()
public java.lang.String describeOptions()
public void setName(java.lang.String n)
setName
in class java.awt.Component
public java.lang.String getName()
getName
in class java.awt.Component
public void setOutput(java.io.PrintWriter pw)
commandline
method will do that automatically.public void setVerbose(boolean flag)
public boolean isVerbose()
public void test() throws TestException
commandline
, but it can also be called directly.TestException
protected void fail(java.lang.String msg)
protected void error(java.lang.String msg)
protected void skip(java.lang.String msg)
protected void error(java.lang.Exception e)
protected void error(java.lang.Throwable e)
protected void pass(java.lang.String msg)
protected void passIf(boolean pass, java.lang.String msg)
protected void setExpectedPasses(int n)
engineTest
method, but should
normally be called at the start of that method.protected void report()
public int getFailures()
public int getErrors()
public int getPasses()
public int getSkipped()
public int getExpectedPasses()
public boolean isOverallPass()
protected abstract void engineTest() throws java.lang.Exception
java.lang.Exception