When task recordings are used to generate automatic tests, form adaptors are needed in order to make the controls available to the test code.
One way to generate or update them is to set the property
Generate Form Adaptors on the project settings to True:
Those classes should not be shipped with the deployable package later. A good way to prevent this is to keep them in a separate model.
And a smart thing to do is to set everything up to automatically generate those form adaptors in the dedicated model.
Here is a step by step rundown:
Create a new model for the form adaptors
Dynamics 365 >
Model Management >
Give it a name like MyModuleFormAdaptors and the same layer as your working model.
Because this model holds forms from the Application Platform/Foundation, add references to following models:
- Application Platform
- Application Foundation
- Application Foundation Form Adaptor
- Application Platform Form Adaptor
- Electronic Reporting App Suite Integration
Reference: D365 docs
Update descriptor file
Open the descriptor file of the new model and add the following node:
Refresh and build models
Refresh the models and build your main model and the new one to make sure the changes are detected.
Check references from test models
Be sure to check the referenced packages of your test models and add the new one to them if needed so the test code can actually use the form adaptors.
From now on form adaptors will be generated in your separate model.