NAV 2015 includes the enhanced C/AL Testability feature set designed to support C/AL test-driven development. Test-driven development is an approach where the application tests are defined prior to the development of the application code. In an ideal situation, the code supporting application tests is written prior to, or at least at the same time as, the code implementing the target application function written.
Advantages of test-driven development include:
The C/AL Testability feature provides test specific types of Codeunits—Test Codeunits and Test Running Codeunits. Test Codeunits contain Test methods, UI handlers, and the C/AL code to support Test methods including the AssertError function. Test Runner Codeunits are used to invoke Test Codeunits, for test execution management, automation, and integration. Test Runner Codeunits have two special triggers, each of which run in separate transactions, so that the test execution state and results can be tracked. The TestRunner trigger descriptions follow:
Among the ultimate goals of the C/AL Testability feature are:
The TestIsolation property of TestRunner Codeunits allow tests to be run, then all database changes are rolled back so that no changes are Committed. After a test series in this mode, the database after the test is the same as it was before the test.
Once the testing Codeunits have been developed, the actual testing process should be simple and fast in order to run and evaluate the results.
Both positive and negative testing are supported. Positive testing looks for a specific result, a correct answer. Negative testing checks that errors are presented when expected, especially when data or parameters are out of range. The testing structure is designed to support the logging of the test results, both failures and success, to tables for review, reporting, and analysis.
A function property defines functions within Test Codeunits to be either Test
, TestHandler
, or Normal
. Another function property, TestMethodType, allows the definition of a variety of Test Function types to be defined. The TestMethodType property options include the following which are designed to handle User Interface events without the need for a user to intervene:
MESSAGE
statement CONFIRM
dialogsSTRMENU
menu dialogsC/SIDE Test Driven Development approach should proceed along the following lines:
On PartnerSource, there is a full set of 7,000 to 9,000 regression tests available that were written by Microsoft for NAV 2013 using the NAV Testability tools. These are the tests that the NAV product developers used to validate their work. The number of tests that applies to a specific situation depends on the local version and specific features involved. At the time of writing this, the tools for NAV 2015 have not been released by Microsoft. To access the download for the NAV 2013 tools, search on testability
and download Application Test Toolset for Microsoft Dynamics NAV 2013. Make sure your license is updated too.
Included in the supplement are the regression tests and various tools for managing and executing tests built on top of the testability features released for Microsoft Dynamics NAV. Also included is a coverage tool and guidance documentation for creating our own tests and integrating those with the Microsoft provided tests. This allows us to do full regression testing for large modifications and ISV solutions.