Skip to main content

%UnitTest Classes

This table describes the primary %UnitTest classes used to create and execute unit tests for Caché classes and methods.

Class Description
TestCase

Extend this class to create a class containing test methods. A test fails if one or more of the AssertX methods returns false; otherwise the test passes.

You will invoke the AssertX methods with their associated macros. The methods and macros are:

  • AssertEqualsViaMacro — Returns true if expressions are equal. Invoke with the $$$AssertEquals macro.

  • AssertNotEqualsViaMacro — Returns true if expressions are not equal. Invoke with the $$$AssertNotEquals macro.

  • AssertStatusOKViaMacro — Returns true if the returned status code is 1. Invoke with the $$$AssertStatusOK macro.

  • AssertStatusNotOKViaMacro — Returns true if the returned status code is 0. Invoke with the $$$AssertStatusNotOK macro.

  • AssertTrueViaMacro — Returns true if the expression is true. Invoke with the $$$AssertTrue macro.

  • AssertNotTrueViaMacro — Returns true if the expression is not true. Invoke with the $$$AssertNotTrue macro.

  • AssertFilesSameViaMacro — Returns true if two files are identical. Invoke with the $$$AssertFilesSame macro.

  • LogMessage — Writes a log message to the ^UnitTest.Result global. Invoke with the $$$LogMessage macro.

Methods to set up and tear down conditions are:

  • OnBeforeOneTest — Executes immediately before each test method in the test class.

  • OnBeforeAllTests — Executes once before any test methods in the test class.

  • OnAfterOneTest — Executes immediately after each test method in the test class.

  • OnAfterAllTests — Executes once after all of the test methods in the test class have executed.

Manager

Launch tests using this class. Its methods include:
  • RunTest — Executes a test or set of tests within a directory.

  • DebugRunTestCase — Executes a test or set of tests without loading or deleting any test classes.

Report Defines the CSP page that reports the results of executing a test or set of tests.
FeedbackOpens in a new tab