|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectlejosunit.rcxui.TestRunner
A TestRunner based on the RCX implementation of leJOS. This TestRunner has to be started through a main program of the test cases. Example:
public class MyTest {
public static void main(String[] args) {
lejosunit.rcxui.TestRunner.main(suite());
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new OneTest ("testOne"));
suite.addTest(new OneTest ("testTwo"));
return suite;
}
}
The TestRunner has a small user interface:
| Field Summary | |
static byte |
DISPLAY_MODE_EMULATOR
display mode when running in emulator |
static byte |
DISPLAY_MODE_RCX
display mode when running at rcx |
static byte |
DISPLAY_MODE_SILENT
display mode when running in silent mode for tests |
| Constructor Summary | |
TestRunner()
|
|
| Method Summary | |
void |
addError(Test test,
java.lang.Throwable t)
Add an error to the runner. |
void |
addFailure(Test test,
AssertionFailedError t)
Add a failure to the runner. |
void |
buttonPressed(josx.platform.rcx.Button button)
The buttonPressed will define the UI behaviour. |
void |
buttonReleased(josx.platform.rcx.Button button)
The buttonRelease will completely be ignored. |
protected TestResult |
createTestResult()
Creates the TestResult to be used for the test run. |
TestResult |
doRun(Test suite)
Run a test or test suite. |
TestResult |
doRun(Test suite,
byte mode)
Run a test or test suite. |
void |
endTest(Test test)
Ends a test. |
java.lang.String |
getDisplayBuffer()
Get the actual display buffer. |
char[] |
getDisplayBufferShown()
Get the actual display buffer shown in display. |
static void |
main(Test suite)
Main program to start the test runner. |
static void |
main(Test suite,
boolean doWait)
Main program to start the test runner. |
protected void |
refreshDisplayBuffer()
Refresh the display buffer on TextLCD |
protected void |
runUntilStopped()
Will run the TestRunner forever. |
protected void |
scrollLeft()
Scrolls one character to left. |
protected void |
scrollRight()
Scrolls one character to right. |
void |
startTest(Test test)
Starts a test. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final byte DISPLAY_MODE_SILENT
public static final byte DISPLAY_MODE_RCX
public static final byte DISPLAY_MODE_EMULATOR
| Constructor Detail |
public TestRunner()
| Method Detail |
public static void main(Test suite)
throws java.lang.RuntimeException
suite - the test or test suite to run
java.lang.RuntimeException - will be raised through
an internal error at TestRunner
public static void main(Test suite,
boolean doWait)
throws java.lang.RuntimeException
suite - the test or test suite to rundoWait - if true, the TestRunner will go into a infinite loop,
to enable scrolling, re-run etc.
java.lang.RuntimeException - will be raised through
an internal error at TestRunnerpublic void buttonPressed(josx.platform.rcx.Button button)
buttonPressed in interface josx.platform.rcx.ButtonListenerbutton - a button from the RCXpublic void buttonReleased(josx.platform.rcx.Button button)
buttonReleased in interface josx.platform.rcx.ButtonListenerbutton - a button from the RCXpublic TestResult doRun(Test suite)
suite - the tests to run
public TestResult doRun(Test suite,
byte mode)
suite - the tests to runmode - the display mode.
Either DISPLAY_MODE_SILENT, DISPLAY_MODE_RCX,
DISPLAY_MODE_EMULATOR
public void startTest(Test test)
startTest in interface TestListenertest - the raising testpublic void endTest(Test test)
endTest in interface TestListenertest - the raising test
public void addError(Test test,
java.lang.Throwable t)
addError in interface TestListenertest - the raising testt - the throwable raising the error
public void addFailure(Test test,
AssertionFailedError t)
addFailure in interface TestListenertest - the raising testt - the assertion failed errorprotected void refreshDisplayBuffer()
public java.lang.String getDisplayBuffer()
public char[] getDisplayBufferShown()
protected void runUntilStopped()
throws java.lang.InterruptedException
java.lang.InterruptedException - can be raised from Thread.sleepprotected TestResult createTestResult()
protected void scrollLeft()
protected void scrollRight()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||