FunctionType Property


The content in this topic only applies to Microsoft Dynamics NAV 2009 SP1. For Microsoft Dynamics NAV 2009 content, see Developer and IT Pro Help for Microsoft Dynamics NAV 2009.

Sets the type of function in a test codeunit.

C/AL functions on test codeunits. A test codeunit is codeunit that has the SubType Property (Codeunit) set to Test.


The FunctionType property is only visible when the Show C/AL Testability properties option of the Classic client is set to Yes. To change this setting, on the Tools menu, click Options.

Value Description


Acts as normal function.


Tests the application.


Handles MESSAGE functions.


Handles CONFIRM functions.


Handles STRMENU functions.


Handles specific forms that are not run modally.


Handles specific forms that are run modally.


Handles specific reports.

You create test codeunits to test your application. A test codeunit can consist of one or more test functions, handler functions, and normal functions.

  • You use test functions that include C/AL code that performs a test on an area of the application. For more information, see How to: Create Test Codeunits and Test Functions.

  • You use handler functions to automate tests by handling instances when user interaction is required by the code that is being tested by the test function. In these instances, the handler function is run instead of the requested user interface. The handler function should simulate the user interaction for the test case, such as validating messages, making selections, or entering values. For example, a test function that has a FunctionType of MessageHandler handles MESSAGE function calls. If the code that is being tested calls the MESSAGE function, then the MessageHandler function that is declared for that test function is called instead of the MESSAGE function. You write code in the MessageHandler function to verify that the expected message is displayed by the MESSAGE function.


    The parameters of the functions that are being handled are passed as parameters to the handler functions. The value of the parameter can be changed by the handler function.

    To set up handler function for use by a test function, you assign the handler function to the HandlerFunctions Property of the test function.

    For more information, see How to: Create Handler Functions

  • You use normal functions to structure the test code by using the same design practices and principles as functions in other codeunits of the application.

Community Additions