- Automated Testing in Microsoft Dynamics 365 Business Central
- Luc van Vugt
- 187字
- 2021-06-24 14:56:50
Pillar 4 – Test runner and test isolation
Goal: Understand what a test runner and its test isolation are and learn how to use and apply them.
Given the previous three pillars, we are positioned to write test cases as follows:
- Using test codeunit and test functions
- Either sunny or rainy path, the latter by applying the asserterror keyword
- With fully automated execution addressing any user interactions by applying handler functions
Do we need more?
As a matter of fact, yes, we do, as we need a way to do the following:
- Run tests stored in multiple codeunits, control their execution, and collect and secure the results
- Run tests in isolation, so that we can achieve the following:
- Write transactions, in the end, do not alter the database we run the test on
- Each rerun of a test is done using the same data setup
Both goals can be accomplished using a so-called TestRunner codeunit with a certain test isolation. A test runner codeunit is defined by its Subtype and the isolation by its TestIsolation:
codeunit Id MyTestRunnerCodeunit
{
Subtype = TestRunner;
TestIsolation = Codeunit;
}