Skip to main content

Executing a Test

There are several different ways to execute a test. TestProduction provides a pair of convenience methods: Run and Debug. In addition, %UnitTest.TestManager provides several methods, including RunTest and DebugRunTestCase. All of these methods require that you assign the global ^UnitTestRoot to either a valid path on the system where you are executing the test or the empty string (""). You can do this from the Terminal:


TUTORIAL>Set ^UnitTestRoot = "C:\Tutorial"

The %UnitTest.ManagerOpens in a new tab methods can look in this directory, or one of its subdirectories, for XML files containing the exported test classes. The methods then load some or all of the test classes into InterSystems IRIS®, compile them, and execute the tests they contain. This is the approach that you will probably want to follow for real-world automated testing.

The following table summarizes some of different options for executing tests using TestProduction methods. Read the class documentation for %UnitTest.ManagerOpens in a new tab for more information on using its methods.

TestProduction Options for Executing Tests
Method Description
TestProduction.Run Runs the test currently loaded in InterSystems IRIS. It does not load any code from ^UnitTestRoot. It does not delete any code from InterSystems IRIS. Requires that you set ^UnitTestRoot equal to either a valid directory path on the system or the empty string.
TestProduction.Debug Runs the test currently loaded in InterSystems IRIS. It does not load any code from ^UnitTestRoot. It does not delete any code from InterSystems IRIS. Requires that you set ^UnitTestRoot equal to either a valid directory path on the system or the empty string. Executes the test in debug mode so that if an error occurs the execution of the test stops.
Note:

For information on executing tests using the %UnitTest.ManagerOpens in a new tab see the class documentation as well as the %UnitTest Tutorial.

FeedbackOpens in a new tab