Dynamics 365 – Acceptance Test Library (ATL) Code Generation Wizard
In a prior blog post, we discussed the new Acceptance Test Library (ATL) feature included in Dynamics 365, Finance and Supply Chain. This feature was initially available in version 10.0.2, and another follow-on feature has been included in version 10.0.4 that allows you to generate ATL code for your own modifications!
The ATL Code Generation Wizard is a feature in the D365 Visual Studio development environment, which automatically generates Entities, Queries, and Specifications that you can use within the ATL framework. The ATL models within D365 contain objects for nearly every situation one would need to test, but with the new Wizard custom objects can be added to the test libraries coverage.
To get started using the wizard, you should create a model where the ATL objects will reside in. This will need a reference to the Acceptance Test Library Foundation model, and should only be used for your ATL code. Keeping this model separate from our customizations will allow us to omit it from production builds when we are generating packages. We also need to make sure this test has a reference to the model where the customization resides.
Once you have a model with the proper references, open the table that you wish to generate code for. Right click the object name, and expand the Addins menu. The options for generating an ATL Query, Specification, or Entity will be displayed.
In the example below, we have a simple table called els_WidgetTable, and we will generate an Entity for the table that will allow us to access it through ATL.
Once the wizard is opened, you are able to select the fields that should be included in your structure, the name of the object, and the destination model where the new objects will be created. It is important to change the destination model to the model you created. Otherwise, you run the risk of accidentally creating objects in the read-only system models, which can be a pain to remove.
Once the field list is configured, we are able to preview the generated code prior to actually generating the artifacts. After this configuration is complete, pressing Generate will create the artifacts in the specified model, where they can then be used in ATL tests.
The code that is generated will allow to interact with custom objects just like they were part of the vanilla objects available in the ATL, setting up tests with Entities and Queries, and validating them with Specifications.
Furthermore, if you have already generated code using the wizard and add additional fields and functionality to your customizations, the wizard will detect it and allow you to update the generated ATL objects. If your organization is planning on fully embracing automated testing utilizing the ATL, maintaining the objects needed is very simple using the wizard.
The Acceptance Test Library code generation wizard is available starting in version 10.0.4, which is available now, so get out there and start testing!
Check out Part 1 of this blog (When RSAT is not enough) here:
Dynamics 365 – Acceptance Test Library (ATL) Code Generation Wizard