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")
Copy code to clipboard

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 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. As we have seen, you can use the “/loadudl” qualifier when you want to load tests from .cls files. You can also use qualifiers to control whether test classes are deleted from server after they are executed, whether tests should be loaded from these external files, or whether the system should enter debug mode after a test failure, and so on. 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 InterSystems IRIS, 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 InterSystems IRIS.
/run (default) Run the test. Use /norun to load but not run any tests.
/delete (default) Delete the test class from InterSystems IRIS 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.
/loadudl Load tests from .cls rather than xml files.

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

FeedbackOpens in a new window