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","userparam")

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 containing test class files. 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 “/nodelete” qualifier when don’t want to delete test classes from the server. For another 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. The default subdirectory is _autoload.
/display Use /display=all (the default) to display extended information when the method is run. Use /display=none to display limited information.

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

The userparam argument is an arbitrary argument passed in by the caller. The manager recognizes one value, “/log”, by default. This tells the manager to minimize output to the terminal and write the detailed results to a file called UNITTEST.LOG in the <install-dir>/mgr directory.

FeedbackOpens in a new tab