Skip to main content

Creating and Executing a Suite of Unit Tests

Here are the basic steps for creating and executing a suite of unit tests:

  1. Create a class (or more than one) that contains methods that you would like to test.

  2. Create a test class (or more than one test class) that extends %UnitTest.TestCase.

  3. Add methods to the test class that will test your method output. Use at least one assertion (AssertX macro) in each method. Begin each test method name with Test.

  4. Export the test class(es) to a file.

  5. Open the Terminal and change to the namespace containing the class(es) that you are going to test. Assign to ^UnitTestRoot a string containing the path to the parent of the directory that contains the exported test class files.

  6. In the Terminal, run %UnitTest.Manager.RunTest passing it the name of the (child) directory that contains the test class files.

  7. Review the test reports. The output in the Terminal includes a URL for a web page that display the results in easy-to-read tables.

The following pages provide more detail as well as step-by-step examples for creating and executing a set of unit tests.

Feedback