Sergio Morozov
A short & concise guide.
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 exceeds specified time (for 1.1.1
and later versions).
Note: MIDletTestRunner 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
Usage of MIDletTestRunner is pretty easy.
Download MIDletTestRunner package from SourceForge.
Add classes contained in this jar to your J2ME application. Use instructions of your IDE or just extract these classes to your source directory. In a case of pure WTK 2.2 just copy this jar to your project lib directory.
Register MIDletTestRunner as midlet in manifest and/or JAD descriptor. Use instructions of your IDE or see an example of descriptor or MIDP documentation
Configure MIDletTestRunner via properties. See below.
Just run your application.
MIDletTestRunner is fully configurable via properties. Your can put configuration properties to the manifest and/or JAD descriptor. Via configuration properties you can configure tests to be run, how result of tests are shown, auto start and timeout features and appearance of test screen (colors, fonts, etc.).
"MoMEUnit-Tests" |
Description of global test suite. Tests to be run should be specified here. Format of this property is a list of test names.
|
||
|
Separator = [ ,;;\t] |
a separator - comma, space, colon,semicolon or tab.
Any separators can be grouped together (e.g. |
|
TestName = <ClassName>|<TestSuiteName> |
|||
ClassName |
a fully specified Test implementation class name as argument to Class.forName() method. |
||
TestSuiteName |
a name of TestSuite configured via "MoMEUnit-Test-<TestSuiteName>" property. |
||
The default value is empty string (no tests). Since version 1.0 |
|||
"MoMEUnit-TestsName" |
Name of global test suite shown as title. The
default value is Since version 1.0 |
||
"MoMEUnit-Test-<TestSuiteName>" |
Description of <TestSuiteName> test suite. Format of this property is the same as of "MoMEUnit-Tests". And of course it is possible to specify other test suites as part of this. TestSuiteName any combination of characters except separators. Note You shouldn't worry about recursion. If test suite contains itself either directly or indirectly, it will be notified by IllegalStateException. Since version 1.0 |
||
"MoMEUnit-AutoStart" |
If Note You can re execute tests more then one time via Test command. Since version 1.0 |
||
"MoMEUnit-TimeOut" |
Maximum duration of tests execution measured from first test start (not from emulator start). If tests didn't finish after that amount of time, their execution stops, MIDletTestRunner prints descriptive message to the standard output and exits. Property takes the format <DoubleLiteral>[<UnitSuffix>]DoubleLiteral is positive double
number string representation as specified by UnitSuffix is an optional case insensitive specification of unit of time. It can be one of the following
To be valid this property must specify duration >= 1ms. If not given tests are executed without time boundaries. Since version 1.1.1 |
"MoMEUnit-Print2StdErr" |
If Note You can always print a descriptive message of failure or error by pressing FIRE key. Since version 1.0 |
"MoMEUnit-PrintStackTrace" |
If Note This includes prints executed via FIRE key. Since version 1.0 |
"MoMEUnit-BGColor" |
Background color. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is dark blue (7f). Since version 1.0 |
"MoMEUnit-FGColor" |
Foreground color. Color of all text elements except statistics. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is white. Since version 1.0 |
"MoMEUnit-SelectedBGColor" |
Background color of selected item. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is white. Since version 1.0 |
"MoMEUnit-SelectedFGColor" |
Foreground color of selected item. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is black. Since version 1.0 |
"MoMEUnit-OkColor" |
Color of progress bar if tests completed successfully. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is green. Since version 1.0 |
"MoMEUnit-FailureColor" |
Color of progress bar if some tests failed, but there were no errors and a color of failure statistics. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is magenta. Since version 1.0 |
"MoMEUnit-ErrorColor" |
Color of progress bar if some tests completed with errors and color of error statistics. The format of this string is integer in hexadecimal format without leading "0x" or "h" suffix (e.g. 7FAD17). The default value is red. Since version 1.0 |
"MoMEUnit-Font" |
Font of all text elements except statistics. The
format of this property is Face = PROPRTIONAL|MONOSPACE|SYSTEM Style = (PLAIN|BOLD|ITALIC|UNDERLINED)(;(PLAIN|BOLD|ITALIC|UNDERLINED))* Size = LARGE|MEDIUM|SMALL Note No spaces are allowed. Tests are case insensitive. The default value is as from Font.getDefaultFont(). Since version 1.0 |
"MoMEUnit-StatisticsFont" |
Font of text of statistics. The format of this property is the same as above. The default value is as from Font.getDefaultFont(). Since version 1.0 |
|
This is one
screen UI. It is very simple. If property "MoMEUnit-AutoStart"
is set to |
Sergio Morozov. 2007