vanvugt: How-to use the "old" Test Tool, aka CAL Test Tool
For a long while, ever since NAV 2016, the Test Tool has been part of the application, which is in a way is somewhat strange as a Test Tool is typically something you don't want to be present in a production environment. Among other - more - important reasons, Microsoft introduced the AL Test Tool in the time of BC15, which resides in it's own extension called Test Runner. This does not reside in a CRONUS database, and thus typically needs to be installed before you can use it. To discriminate better between the two test tools I will refer to the first as CAL Test Tool - which happens to be the internal naming anyway - and the AL Test Tool.
Both test tools allow you to manage and run the automated tests that reside in the database, and collect their results, be they test codeunits that belong to the standard application or that are part of your code, C/AL or AL based extensions. In the 1st edition of my book Automated Testing in Microsoft Dynamics 365 Business Central, written for BC14 and older versions, the AL Test Tool did not yet exist and in the various hands-on test example I heavily made use of the CAL Test Tool. The 2nd edition of the book, to be released in October and based on BC19, will make use of the AL Test Tool as the CAL Test Tool will be soon deprecated. So, no mentioning of the latter test tool anymore in the 2nd edition.
For those, however, still wanting to use the CAL Test Tool, I will share in this blog post the description of this test tool from the 1st edition of the book.
Access the CAL Test Tool
You can easily access the test tool by searching for Test Tool in either the Windows or the Web client. When in a clean database, or at least a database or company where the Test Tool has not been used yet, this is how the Test Tool appears. A suite called DEFAULT with no records in it appears, as seen as follows:
Populate the CAL Test Tool
To populate the suite take the following steps:
Note: as mentioned the 60000 range objects were created as part of Chapter 2 of the 1st edition. The code for these test codeunit can be found on the GitHub repo, folder Chapter 2, that goes with that edition: Automated Testing in Microsoft Dynamics 365 Business Central, published by Packt (github.com).
Had we selected the option Active Codeunit only, the selected codeunit would have been executed.
For each failure, the First Error field will display the error that caused the failure. As you can see, First Error is a FlowField. If you drill down into it, the CAL Test Result window opens. This displays the whole test run history for a specific test. Note that the message dialog in MyFirstTestCodeunit yields an Unhandled UI error.
Running the test by selecting Run will call the standard test runner codeunit CAL Test Runner (130400) and will make sure that the following happen:
The CAL Test Tool also holds a powerful feature that can be of great help in picking out relevant test codeunits for the code update you are working on. It is called Test Coverage Map (TCM). It combines the result of the code coverage tool that also resides in Business Central and the test tool. Having TCM turned on, it adds two extra options to the Get Test Codeunits feature already demoed in Chapter 3, The Test Tool and Standard Tests. There, we explained that Get Test Codeunits offers the following two options to let you populate your test suite:
Choosing the third option, Get Test Codeunits based on Modified Objects, will select those test codeunits that will hit the application objects you are working on. The fourth option, Get Test Codeunits based on Selected Objects, let’s you select from a list those application objects you want to run tests against.
At this very moment, the Get Test Codeunits based on Modified Objects option only takes into account the application objects that reside in standard, that is, in C/SIDE. Unfortunately, it does not yet consider objects that reside in extensions.
Note: Probably for the latter reason TCM is only part of the CAL Test Tool and not of the AL Test Tool.The fourth option, Get Test Codeunits based on Selected Objects, nevertheless includes all application objects.
To be able to use TCM, you need to turn it on. To do this, check mark the Update Test Coverage Map field on a test suite. If this has not been turned on, on any test suite, TCM will not have data to allow you to choose Get Test Codeunits based on Modified Objects and Get Test Codeunits based on Selected Objects options as described previously.
Note: For TCM to have the data available to do its job, the activated test suite should be run first.In this overview of the CAL Test Tool, we used the following features:
It will be published around the released of Dynamics 365 Business Central 2021 wave 2. You can read about its project content here: Automated Testing in Microsoft Dynamics 365 Business Central: Efficiently automate test cases for faster development cycles with less time needed for manual testing, 2nd Edition.
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
|vanvugt: How-to: Find and Use standard test Helper Functions||Blog bot||NAV: Blogs||0||11.01.2021 12:55|
|vanvugt: Test Tool Extension||Blog bot||NAV: Blogs||0||08.03.2020 15:16|
|vanvugt: Let's talk about Shared Fixture and how to profit from this with the Dynamics NAV Test Toolkit||Blog bot||NAV: Blogs||0||22.03.2018 22:13|
|vanvugt: How we started using the Test Toolkit||Blog bot||NAV: Blogs||0||22.06.2017 13:11|
|Platform updates overview - 3.70.B - NAV2009 R2||Blog bot||Dynamics CRM: Blogs||0||07.02.2011 22:06|
|Опции темы||Поиск в этой теме|