Home > Class Reference > ENSLIB namespace > %UnitTest.Manager

%UnitTest.Manager

class %UnitTest.Manager extends %Library.RegisteredObject

Launches tests using any of the following methods:

RunTest: Runs a set of tests and deletes all test classes afterwards.

RunTestSuites: Same as RunTest, but requires 3 arguments, all of which can be null.

DebugRunTestCase: Can be used after DebugLoadTestSuite. It runs tests and does not delete the test classes afterwards, like RunTest does.

Setup: Set the global variable ^UnitTestRoot to a root directory that contains your test suites. This must point to a valid directory. Example: Set ^UnitTestRoot="C:\MyUnittests" (adding a final slash is optional).

Specifically, the RunTest method does the following:
  1. Loads and compiles any test files in the directory specified by the first argument, testspec. If the loadxml qualifier is on, all .xml or .XML files will be loaded.
    If the loadudl qualifier is on, all udl files will be loaded.

  2. For each class that is a subclass of %UnitTest.TestCase, RunTest

    1. Runs the OnBeforeAllTests() method

    2. For each method named Test*, such as TestXyz, RunTest

      1. Runs the method OnBeforeOneTest()
      2. Runs the method TestXyz()
      3. Runs the method OnAfterOneTest()

    3. Repeats steps i through iii for all the other methods named Test*

    4. Runs OnAfterAllTests() method

  3. Repeats steps A through D for each class that is a subclass of %UnitTest.TestCase.

  4. Deletes all the classes loaded during execution.

  5. Repeats step 1 through 4 recursively (for all sub-directories) through the specified directory (assuming that the /recursive qualifier is on and skipping any directory whose name begins with an underscore).
The loading, running and deletion actions each can be skipped by specifying /noload, /norun and /nodelete qualifiers.
Unit test logs testcase output to the global ^UnitTest.Result. Results displayed on CSP pages come from this global.

Note: This reference material draws from the article Unit Testing in Cache by Ramon Jimenez.

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property CurrentDir;
The directory that contains the current test.
Property methods: CurrentDirDisplayToLogical(), CurrentDirGet(), CurrentDirIsValid(), CurrentDirLogicalToDisplay(), CurrentDirLogicalToOdbc(), CurrentDirNormalize(), CurrentDirSet()
property Debug;
Set to true if the /debug qualifier is on.
Property methods: DebugDisplayToLogical(), DebugGet(), DebugIsValid(), DebugLoadTestSuite(), DebugLogicalToDisplay(), DebugLogicalToOdbc(), DebugNormalize(), DebugRunTestCase(), DebugSet()
property Display;
Set to true if the /display=all qualifier is set.
Property methods: DisplayDisplayToLogical(), DisplayGet(), DisplayIsValid(), DisplayLogicalToDisplay(), DisplayLogicalToOdbc(), DisplayNormalize(), DisplaySet()
property LoadUDL;
Set to true if the /loadudl qualifier is set. UDL files are .cls, .mac, .int, .inc, or the upper case extensions.
Property methods: LoadUDLDisplayToLogical(), LoadUDLGet(), LoadUDLIsValid(), LoadUDLLogicalToDisplay(), LoadUDLLogicalToOdbc(), LoadUDLNormalize(), LoadUDLSet()
property LoadXML;
Set to true if the /loadxml qualifier is set.
Property methods: LoadXMLDisplayToLogical(), LoadXMLGet(), LoadXMLIsValid(), LoadXMLLogicalToDisplay(), LoadXMLLogicalToOdbc(), LoadXMLNormalize(), LoadXMLSet()
property LogIndex;
Property methods: LogIndexDisplayToLogical(), LogIndexGet(), LogIndexIsValid(), LogIndexLogicalToDisplay(), LogIndexLogicalToOdbc(), LogIndexNormalize(), LogIndexSet()
property NSInfo [ Private , MultiDimensional ];
Private property to hold information about this namespace so we can cleanup
Property methods: NSInfoDisplayToLogical(), NSInfoGet(), NSInfoIsValid(), NSInfoLogicalToDisplay(), NSInfoLogicalToOdbc(), NSInfoNormalize(), NSInfoSet()
property ReportVariableLeaks;
Set to true if unexpected public variables should trigger an error.
Property methods: ReportVariableLeaksDisplayToLogical(), ReportVariableLeaksGet(), ReportVariableLeaksIsValid(), ReportVariableLeaksLogicalToDisplay(), ReportVariableLeaksLogicalToOdbc(), ReportVariableLeaksNormalize(), ReportVariableLeaksSet()
property TempLogIndex [ Private ];
Private property for internal use only
Property methods: TempLogIndexDisplayToLogical(), TempLogIndexGet(), TempLogIndexIsValid(), TempLogIndexLogicalToDisplay(), TempLogIndexLogicalToOdbc(), TempLogIndexNormalize(), TempLogIndexSet()
property TheStack [ Private , MultiDimensional ];
Private property for internal use only
Property methods: TheStackDisplayToLogical(), TheStackGet(), TheStackIsValid(), TheStackLogicalToDisplay(), TheStackLogicalToOdbc(), TheStackNormalize(), TheStackSet()
property UserFields as array of