|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--java.applet.Applet | +--cryptix.util.test.BaseTest
This abstract class acts as a base for all Cryptix test classes. Its purpose is to provide a framework that will allow us to easily add new testing features. Features that have already been added include:
Planned features include:
Copyright © 1997, 1998
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.5 $
Inner classes inherited from class java.applet.Applet |
java.applet.Applet.AccessibleApplet |
Inner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
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. |
Fields inherited from class java.applet.Applet |
accessibleContext |
Fields inherited from class java.awt.Container |
component, containerListener, layoutMgr, listeningBoundsChildren, listeningChildren, ncomponents |
Fields inherited from class java.awt.Component |
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
protected |
BaseTest()
Constructor for use by subclasses. |
Method Summary | |
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. |
Methods inherited from class java.applet.Applet |
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
Methods inherited from class java.awt.Panel |
|
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paint, paintComponents, paintHeavyweightComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, setLayout, transferFocus, update, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.io.PrintWriter status
protected java.io.PrintWriter out
Constructor Detail |
protected BaseTest()
Method Detail |
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.
public void parseOptions(java.lang.String[] args, int offset) throws 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.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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |