Skip to main content

Options for Executing Tests: Test Specs and Qualifiers

In general, you execute RunTest using a command of the following form:

Do ##class(%UnitTest.Manager).RunTest("testspec","qualifiers")

The testspec argument determines which tests to run and where to find them. The general form of testspec is testsuite:testcase:testmethod, where

  • testsuite (mandatory). A directory of XML files containing exported test classes. The directory must be a subdirectory of the directory named by ^UnitTestRoot. By default, the test manager executes all the tests in all of the files contained in this directory and its subdirectories.

  • testcase (optional). Selects a single class containing test methods to execute. The format is PackageName.ClassName. When present, the test manager executes only the tests in the named class.

  • testmethod (optional). Singles out a method of the test class indicated by testcase to execute.

The qualifiers argument specifies various options for running the test, for example, whether or not to delete the test class from Caché after executing it. The qualifiers argument is an optional string of command-line arguments that turn on or off certain test manager behaviors. For example, “/noload/debug” tells the manager to not load any tests from a directory, that is, use the test currently in Caché, and to run the test in debug mode. These qualifiers are so-called negatable Booleans. This means, for example, that “/noload” is equivalent to “/load=0”.

Qualifier Meaning
/load (default) Load the test from a directory. Use /noload to load no tests and execute the tests already contained in Caché.
/run (default) Run the test. Use /norun to load but not run any tests.
/delete (default) Delete the test class from Caché after executing. Use /nodelete to save the class.
/recursive (default) Look for tests in subdirectories of the named directory. Use /norecursive to not execute tests contained in subedirectories.
/debug (default is /nodebug) With /debug, no tests are executed after the first test failure. When executing from the Terminal, the Terminal will enter debugging mode after the first failure.
/autoload Use /autoload=dir to load tests from subdirectory “dir” of the ^UnitTestRoot directory.

In all cases, ^UnitTestRoot must point to a valid directory.

FeedbackOpens in a new tab