cryptix.util.test
public abstract class BaseTest extends Applet
Planned features include:
Copyright © 1997, 1998
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.5 $
Since: Cryptix 2.2.2
| Field Summary | |
|---|---|
| protected PrintWriter | out The PrintWriter to which delayed output is sent. |
| protected PrintWriter | status The PrintWriter to which immediate output is sent. |
| Constructor Summary | |
|---|---|
| protected | BaseTest() Constructor for use by subclasses. |
| Method Summary | |
|---|---|
| protected void | commandline(String[] args)
Used to run a test from the command line. |
| protected void | commandline(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). |
| String | describeOptions() Describes the command-line options of this class. |
| 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(String msg)
Reports an error, with the given message. |
| protected void | error(Exception e)
Reports an error due to an unexpected exception. |
| protected void | error(Throwable e) |
| protected void | fail(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. |
| 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(String option)
Parses a command-line option. |
| void | parseOptions(String[] args, int offset)
Processes command-line arguments from args, starting at index
offset. |
| protected void | pass(String msg)
Reports a pass, with the given message. |
| protected void | passIf(boolean pass, 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(String n)
Sets the name of this test (as shown to the user). |
| void | setOutput(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(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. |
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);
}
super.parseOption(option) should be called.
Case should generally not be significant in option names.
engineTest method, but should
normally be called at the start of that method.commandline
method will do that automatically.commandline, but it can also be called directly.