Example: Executing a Test Using Setup and Tear Down Methods
Execute the new unit test in the usual fashion.
Open the Terminal in the namespace in which you have been working.
Set the value of ^UnitTestRoot to the parent of the directory containing your test class:
USER> Set ^UnitTestRoot="c:\unittests"
Execute the tests using %UnitTest.ManagerOpens in a new tab:
USER> Do ##class(%UnitTest.Manager).RunTest("mytests")
InterSystems IRIS loads the test class, compiles the class, executes the test, and delivers a report to the terminal.
=============================================================================== Directory: C:\unittests\mytests\cls\MyPackage\ =============================================================================== mytests\cls\MyPackage begins ... Load of directory started on 07/05/2022 12:00:50 '*.xml;*.XML;*.cls;*.mac;*.int;*.inc;*.CLS;*.MAC;*.INT;*.INC' Loading file C:\unittests\mytests\cls\MyPackage\MyPackage.Tests.cls as udl Compilation started on 07/05/2022 12:00:50 Compiling class MyPackage.Tests Compiling routine MyPackage.Tests.1 Compilation finished successfully in 0.018s. Load finished successfully. MyPackage.Tests begins ... TestAdd() begins ... AssertEquals:Test Add(2,2)=4 (passed) AssertNotEquals:Test Add(2,2)'=5 (passed) LogMessage:Duration of execution: .000032 sec. TestAdd passed TestEditContact() begins ... AssertStatusNotOK:ContactType = Friend (passed) AssertStatusOK:ContactType = Personal (passed) LogMessage:Duration of execution: .002808 sec. TestEditContact passed MyPackage.Tests passed mytests/cls/MyPackage passed Use the following URL to view the result: http://172.30.160.1:52797/csp/sys/%25UnitTest.Portal.Indices.cls?Index=5&$NAMESPACE=USER All PASSED