Difference between revisions of "UNITTEST"
From ICE Enterprises
ConvertBot (talk | contribs) (Runs a set of unit tests.) |
(No difference)
|
Latest revision as of 17:05, 27 April 2020
Runs a set of unit tests.
<OPT> The option to run the unit tests for or the name of the individual test
class to run. [DEF=SYS]
<RES> The table to write the results of running the tests to. [OPTIONAL]
This will run a complete set of unit tests for an option tree. At the conclusion
of running the tests the results will be written to the table named <RES> or
will be printed to the terminal (if <RES>="").
The names of the individual tests will be read in from the unittest_config.tbl
file that should be in the test/junit directory of the indicated option tree.
The structure of the option tree should look like this:
opt
+- lib
| +- Foo (The class to test, nxm.opt.lib.Foo)
+- libg
| +- Bar (Another class to test, nxm.opt.libg.Bar)
+- test
+- junit
+- unittest_config.tbl (List of the available unit tests)
+- lib
+- FooTest (JUnit test class, nxm.opt.test.junit.lib.FooTest)
+- libg
+- BarTest (JUnit test class, nxm.opt.test.junit.libg.BarTest)
To run the test cases for a single unit test file set <OPT> to the full name
of the unit test file (e.g. "nxm.sys.test.junit.lib.UtilTest") or give the full
name of the NeXtMidas class being tested (e.g. "nxm.sys.lib.Cache").
Examples:
1. Run the unit tests for the SYS option tree:
nM> unittest SYS
2. Run the unit tests for the SYS option tree but with limited output:
nM> unittest/verbose=0 SYS
3. Run the unit tests in the class file nxm.sys.test.junit.lib.UtilTest:
nM> unittest nxm.sys.test.junit.lib.UtilTest
4. Run the unit tests for the class nxm.sys.lib.Cache:
nM> unittest nxm.sys.lib.Cache
5. Build one of the unit tests in the SYS option tree
nM> build FileUtilTest test/junit/lib sys
-OR-
nM> build junit/lib/FileUtilTest.java test sys
Switches:
/VERBOSE Turns on/off the printing to the console of the results for testing
each method.
/FAILURE Prints an informational message about each failure (this is turned
on by default if VERBOSE is on and off if VERBOSE is off).
/ERROR Prints an informational message about each error (this is turned
on by default if VERBOSE is on and off if VERBOSE is off).
/ST Print a stack trace to accompany any error or failure error messages
(this has no affect if FAILURE and ERROR are both off).
SEE ALSO: CONFIDENCE, nxm.sys.test.junit.NMTestCase