The xRM Test Framework is a set of tools that allows you easily and quickly create automated units and integration tests for your Dynamics CRM extensions.
Testing plug-ins and custom workflow activities can be quite challenging and time consuming using standard approaches. This sometimes discourages developers from writing automated tests for Dynamics CRM extensions. This can lead to quality issues and wasted effort and time down the line. The framework attempts to encourage the adoption of testing best practices in Dynamics CRM projects.
Below is what the framework provides.
Base Test Library
- Bases classes for testing Plug-ins and Custom Workflow Activities. All tests extend from these classes.
- These cover your Unit & Integration Tests
- These do most of the ground work and allow you to focus on writing your test scenarios in your tests.
- Available via NuGet
- Support for Microsoft Fakes & Moq
Below is a high level diagram for the base classes.
To add the Xrm.Framework.Test assembly to your existing Test project.
- In your existing test project – Right click on References -> Manage NuGet Packages…
- Click on Online in the left tree and then search for “Xrm.Framework.Test”
- Click install – this will add the assembly and the NuGet package to your project
You should be able to see the below:
Productivity Tools
- These provide templates to enforce standard patterns and best practices
- Templates allow you to easily and consistently create your tests
- Visual Studio Project Templates for creating Test Projects
- Visual Studio Templates for creating Tests for different extensions
- Available via the Visual Studio Gallery
To get start just install the extension from the visual studio.
- Open Visual Studio
- From the menu bar click on Tools -> Extensions & Updates…
- Click on Online in the left tree and then search for “xRM”
- Download and install the extension
You should be able to see the below:
You can also download it from Visual Studio Gallery directly.
After you install the extension you should be to create a new Test project by going into the “Dynamics CRM” category in Visual Studio. Below is what you should be able to see in addition to the CRM Developer Toolkit templates.
After you create the project you should be able to add new Tests to your project using the Framework templates. Again these will be in the “Dynamics CRM” category as you can see below.
Finally I would like to thank Ramon Tebar (MVP) for his help and contributions especially in making this Framework work with Microsoft Fakes and Dynamics CRM 2013.
So whats next? In future posts I will show how to create different types of tests for your CRM extensions.
