momeunit.runner
Class MIDletTestRunner

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

public class MIDletTestRunner
extends MoXMIDlet

MIDletTestRunner is a fully configurable MIDlet. It is intended to run tests in emulator (e.g. WTK emulator) or mobile device. It shows the results of tests run (progress bar, statistics, lists of failures or errors with detailed messages) in one screen. The tests can be run automatically during start-up (depends on configuration) and re executed more times later. It can print descriptive messages of failures and errors thrown together with stack-trace to the standard error output. It can also stop tests execution, when duration of their run (measured from first test start) exceeds specified timeout. You can find more details at package description.

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 AUTO_START_PROPERTY
          Autostart property name.
static String BGCOLOR_PROPERTY
          Background color property name.
static String DEFAULT_SUITE_NAME
          Global test suite default name.
static String ERROR_COLOR_PROPERTY
          Error color property name.
static String FAILURE_COLOR_PROPERTY
          Failure color property name.
static String FGCOLOR_PROPERTY
          Foreground color property name.
static String FONT_PROPERTY
          Font property name.
static String OK_COLOR_PROPERTY
          Ok color property name.
static String PRINT2STDERR_PROPERTY
          Print test events flag property name.
static String PRINTSTACKTRACE_PROPERTY
          Print stack-trace flag property name.
static String SELECTED_BGCOLOR_PROPERTY
          Selected item background color property name.
static String SELECTED_FGCOLOR_PROPERTY
          Selected item foreground color property name.
static String STATISTICS_FONT_PROPERTY
          Statistics font property name.
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
MIDletTestRunner()
           
 
Method Summary
protected  void initApp()
          Generates global test suite, instantiates test screen canvas.
protected  void setTimeOut()
           
protected  void startApp()
          Makes the test screen current and starts tests execution if autostart flag is true.
 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

SELECTED_FGCOLOR_PROPERTY

public static final String SELECTED_FGCOLOR_PROPERTY
Selected item foreground color property name.

Since:
1.0
See Also:
Constant Field Values

SELECTED_BGCOLOR_PROPERTY

public static final String SELECTED_BGCOLOR_PROPERTY
Selected item background color property name.

Since:
1.0
See Also:
Constant Field Values

ERROR_COLOR_PROPERTY

public static final String ERROR_COLOR_PROPERTY
Error color property name. Color of progress bar when some tests completed with errors.

Since:
1.0
See Also:
Constant Field Values

FAILURE_COLOR_PROPERTY

public static final String FAILURE_COLOR_PROPERTY
Failure color property name. Color of progress bar when some tests fail and there are no errors.

Since:
1.0
See Also:
Constant Field Values

OK_COLOR_PROPERTY

public static final String OK_COLOR_PROPERTY
Ok color property name. Color of progress bar when tests completed successfully.

Since:
1.0
See Also:
Constant Field Values

FGCOLOR_PROPERTY

public static final String FGCOLOR_PROPERTY
Foreground color property name.

Since:
1.0
See Also:
Constant Field Values

BGCOLOR_PROPERTY

public static final String BGCOLOR_PROPERTY
Background color property name.

Since:
1.0
See Also:
Constant Field Values

FONT_PROPERTY

public static final String FONT_PROPERTY
Font property name.

Since:
1.0
See Also:
Constant Field Values

STATISTICS_FONT_PROPERTY

public static final String STATISTICS_FONT_PROPERTY
Statistics font property name.

Since:
1.0
See Also:
Constant Field Values

AUTO_START_PROPERTY

public static final String AUTO_START_PROPERTY
Autostart property name.

Since:
1.0
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

PRINTSTACKTRACE_PROPERTY

public static final String PRINTSTACKTRACE_PROPERTY
Print stack-trace flag property name.

Since:
1.0
See Also:
Constant Field Values

PRINT2STDERR_PROPERTY

public static final String PRINT2STDERR_PROPERTY
Print test events flag property name.

Since:
1.0
See Also:
Constant Field Values

TEST_PROPERTY_PREFIX

public static final String TEST_PROPERTY_PREFIX
Test suite description property prefix.

Since:
1.0
See Also:
Constant Field Values

TESTS_PROPERTY

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

Since:
1.0
See Also:
Constant Field Values

TESTSNAME_PROPERTY

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

Since:
1.0
See Also:
Constant Field Values

DEFAULT_SUITE_NAME

public static final String DEFAULT_SUITE_NAME
Global test suite default name.

Since:
1.0
See Also:
Constant Field Values
Constructor Detail

MIDletTestRunner

public MIDletTestRunner()
Method Detail

initApp

protected void initApp()
                throws MIDletStateChangeException
Generates global test suite, instantiates test screen canvas.

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.
Since:
1.0
See Also:
MoXMIDlet.initApp()

setTimeOut

protected void setTimeOut()

startApp

protected void startApp()
                 throws MIDletStateChangeException
Makes the test screen current and starts tests execution if autostart flag is true.

Overrides:
startApp in class MoXMIDlet
Throws:
MIDletStateChangeException
Since:
1.0
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)