I need to start doing unit testing for some of my code.

Why does it delete the unit testing class from Cache when I run the test?

Is there a way to turn this off?

  • 0
  • 0
  • 131
  • 5
  • 1


You can specify /nodelete qualifier when you run your tests.

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

Look at the documentation for other options.

The %UnitTest package is designed such that each suite stands alone: it is loaded, compiled, run, and deleted, independent of any other suite. Deleting the test classes is just part of cleaning up.

You can pass the /nodelete qualifier, or even set it as a default using $system.OBJ.SetQualifiers(). Given that deletion is the default behavior, however, I suggest that you adjust your workflow accordingly. I edit XML export files directly. Some people maintain a development and test namespace, with the classes being exported from development, and imported into test.

I see, it was meant to be used in the QA environment.

I am using it in our DEV environment, testing bits of functions as I complete them.

Thank you.


Can anybody expain me how to create test case for various methods in a class In the documentation it is given for just one method (add) how to create your own test case for complex classes

Hi Pratik! I think it makes sense to raise a new question with this.