jmunit.framework.cldc11
Class TestRunner

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by jmunit.framework.cldc11.Assertion
          extended by jmunit.framework.cldc11.Test
              extended by jmunit.framework.cldc11.TestRunner

public abstract class TestRunner
extends Test

The TestRunner class runs a test immediately on launching of a MIDlet. The MIDlet shuts down shortly after the tests finish. This class should be used

Since:
JMUnit 1.1.
Author:
C.A. Meijer

Field Summary
 
Fields inherited from class jmunit.framework.cldc11.Test
name, results
 
Constructor Summary
TestRunner(int delay)
          Constructor.
TestRunner(java.lang.String name, int delay)
          Constructor.
 
Method Summary
 int countTestCases()
          Counts the number of tests.
 void doStart()
          We override the doStart method to run the tests immediately.
protected abstract  Test getNestedTest()
          A TestRunner needs to run some wrapped Test.
 void run(TestResult results)
          Runs and reports the tests.
 
Methods inherited from class jmunit.framework.cldc11.Test
destroyApp, getName, pauseApp, startApp, test
 
Methods inherited from class jmunit.framework.cldc11.Assertion
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, fail, fail, fail, fail, fail, fail, fail, fail, fail
 
Methods inherited from class javax.microedition.midlet.MIDlet
getAppProperty, notifyDestroyed, notifyPaused, resumeRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestRunner

public TestRunner(int delay)
Constructor.

Parameters:
delay - The delay in milliseconds after which the MIDlet should close down.
Since:
JMUnit 1.1.

TestRunner

public TestRunner(java.lang.String name,
                  int delay)
Constructor.

Parameters:
name - The test name.
delay - The delay in milliseconds after which the MIDlet should close down.
Since:
JMUnit 1.1.
Method Detail

getNestedTest

protected abstract Test getNestedTest()
A TestRunner needs to run some wrapped Test. This method must return the test that needs to run. Note: It would be better to pass the test to this class via the TestRunner constructor. While that works in the emulator it does not work on the Sony-Ericsson W200i (and, presumably other MIDs). This is a workaround.

Returns:
The test to run on startup.
Since:
JMUnit 1.1.

doStart

public void doStart()
We override the doStart method to run the tests immediately.

Overrides:
doStart in class Test
Since:
JMUnit 1.1.

countTestCases

public int countTestCases()
Counts the number of tests.

Specified by:
countTestCases in class Test
Returns:
The number of test cases.
Since:
JMUnit 1.1.

run

public void run(TestResult results)
Runs and reports the tests.

Specified by:
run in class Test
Parameters:
results - The TestResult where the results are gathered.
Since:
JMUnit 1.1.