momeunit.runner
Class AntTestRunner

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by mome.MoMIDlet
          extended by mome.MoXMIDlet
              extended by momeunit.runner.AntTestRunner
All Implemented Interfaces:
CommandListener, ItemCommandListener, ItemStateListener, XCommandListener, TestListener

public class AntTestRunner
extends MoXMIDlet
implements TestListener

Test runner that generates test events to be processed by formatters of MoMEUnit Ant Integration package. It creates test events of tests run, sends them to recipient via System.err output stream and exits.

Note: It is built upon MoMELib library. This is a J2ME library that offers possibilities to execute commands in separate from AMS (Application Management Software) callback thread, issue commands programmatically, associate key (game action) or sequence of keys and/or game actions with command, use any complimentary argument with command and much more. If you are interested, visit MoMELib Home Page

Version:
1.1.2
Author:
Sergio Morozov

Field Summary
static String DEFAULT_SUITE_NAME
          Global test suite default name.
static String HALTONERROR_PROPERTY
          HaltOnError property name.
static String HALTONFAILURE_PROPERTY
          HaltOnFailure property name.
static String HEREDOCUMENT_TESTEVENT_INDICATOR
          Test event here-document indicator.
static String ITEM_SEPARATOR
          Item separator string.
static String TEST_PROPERTY_PREFIX
          Test suite description property prefix.
static String TESTS_PROPERTY
          Global test suite description property name.
static String TESTSNAME_PROPERTY
          Global test suite name property name.
static String TIMEOUT_PROPERTY
          Timeout property name.
 
Fields inherited from class mome.MoXMIDlet
ITEM_STATE_CHANGED
 
Constructor Summary
AntTestRunner()
           
 
Method Summary
 void addError(Test test, Throwable t)
          Sends error test event.
 void addFailure(Test test, AssertionFailedError t)
          Sends failure test event.
 void endTest(Test test)
          Sends end test event.
protected  void initApp()
          Generates global test suite.
protected  void setTimeOut()
           
protected  void startApp()
          Starts tests run, creates and sends test events and then exits.
 void startTest(Test test)
          Sends start test event.
 void xCommandAction(Object cmd, Object src)
          Indicates that a command event has occurred.
 
Methods inherited from class mome.MoXMIDlet
commandAction, commandAction, destroyApp, getExecutor, itemStateChanged, pauseApp, pushCommand, setCommandEventsHeapSize, startExecutor, stopExecutor
 
Methods inherited from class mome.MoMIDlet
exit, getDisplay, isInitialized
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ITEM_SEPARATOR

public static final String ITEM_SEPARATOR
Item separator string.

Since:
1.1
See Also:
Constant Field Values

TEST_PROPERTY_PREFIX

public static final String TEST_PROPERTY_PREFIX
Test suite description property prefix.

Since:
1.1
See Also:
Constant Field Values

TESTS_PROPERTY

public static final String TESTS_PROPERTY
Global test suite description property name.

Since:
1.1
See Also:
Constant Field Values

TESTSNAME_PROPERTY

public static final String TESTSNAME_PROPERTY
Global test suite name property name.

Since:
1.1.1
See Also:
Constant Field Values

DEFAULT_SUITE_NAME

public static final String DEFAULT_SUITE_NAME
Global test suite default name.

Since:
1.1
See Also:
Constant Field Values

TIMEOUT_PROPERTY

public static final String TIMEOUT_PROPERTY
Timeout property name.

Since:
1.1.1
See Also:
Constant Field Values

HALTONERROR_PROPERTY

public static final String HALTONERROR_PROPERTY
HaltOnError property name.

Since:
1.1.2
See Also:
Constant Field Values

HALTONFAILURE_PROPERTY

public static final String HALTONFAILURE_PROPERTY
HaltOnFailure property name.

Since:
1.1.2
See Also:
Constant Field Values

HEREDOCUMENT_TESTEVENT_INDICATOR

public static final String HEREDOCUMENT_TESTEVENT_INDICATOR
Test event here-document indicator.

Since:
1.1
See Also:
Constant Field Values
Constructor Detail

AntTestRunner

public AntTestRunner()
Method Detail

initApp

protected void initApp()
                throws MIDletStateChangeException
Generates global test suite.

Overrides:
initApp in class MoXMIDlet
Throws:
MIDletStateChangeException - is thrown if the MIDlet cannot start now but might be able to start at a later time.
See Also:
MoXMIDlet.initApp()

setTimeOut

protected void setTimeOut()

startApp

protected void startApp()
                 throws MIDletStateChangeException
Starts tests run, creates and sends test events and then exits.

Overrides:
startApp in class MoXMIDlet
Throws:
MIDletStateChangeException
See Also:
MoXMIDlet.startApp()

xCommandAction

public void xCommandAction(Object cmd,
                           Object src)
Description copied from class: MoXMIDlet
Indicates that a command event has occurred. This method is invoked in commands execution thread.

Specified by:
xCommandAction in interface XCommandListener
Overrides:
xCommandAction in class MoXMIDlet
Parameters:
cmd - An object identifying the command. This can be any object. Implementation should test on specific command by identity not equality.
src - An object on which this event has occurred. Either Displayable or Item or can be used as parameter for any user command.
See Also:
XCommandListener.xCommandAction(java.lang.Object, java.lang.Object)

addError

public void addError(Test test,
                     Throwable t)
Sends error test event.

Specified by:
addError in interface TestListener
Parameters:
test - test that threw the error.
t - exception thrown by test.
See Also:
TestListener.addError(momeunit.framework.Test, java.lang.Throwable)

addFailure

public void addFailure(Test test,
                       AssertionFailedError t)
Sends failure test event.

Specified by:
addFailure in interface TestListener
Parameters:
test - the failed test.
t - exception thrown by test.
See Also:
TestListener.addFailure(momeunit.framework.Test, momeunit.framework.AssertionFailedError)

endTest

public void endTest(Test test)
Sends end test event.

Specified by:
endTest in interface TestListener
Parameters:
test - test that ends.
See Also:
TestListener.endTest(momeunit.framework.Test)

startTest

public void startTest(Test test)
Sends start test event.

Specified by:
startTest in interface TestListener
Parameters:
test - test that starts.
See Also:
TestListener.startTest(momeunit.framework.Test)