Sets the codeunit to function as a normal, test, or test runner codeunit.

Applies To


Property Value



A normal codeunit. This is the default setting.


A test codeunit includes C/AL functions that test the application. For more information, see How to: Create Test Codeunits and Test Functions.


A test runner codeunit manages the execution of one or more test codeunits. For more information, see How to: Create a Test Runner Codeunit.


You can create test codeunits and test runner codeunits to test your application.

You write test functions as C/AL code in the test codeunits. When a test codeunit runs, it executes the OnRun function and then executes each test function in the codeunit, records the outcome in a log, and displays the results in a message window. The continuation of the test function run is dependent on successful run of the OnRun function. The difference between a normal codeunit and a test codeunit is their execution at run time. When a normal codeunit is run, if one of its functions fails, then the codeunit is terminated. When a test codeunit is run, if a function fails, then the function is terminated, but the codeunit continues to run the remaining functions.

A test runner codeunit runs the test codeunits that are programmed to run from its OnRun trigger. When a test runner codeunit runs, it does the following:

  • Calls the OnBeforeTestRun Trigger before each test codeunit, and the OnRun function and test function is executed.
  • Calls the OnAfterTestRun Trigger after each test code unit, and the OnRun function and test function is executed.
  • Indicates that a test function has failed if it invokes the user interface.

For more information, see Testing the Application.

See Also