Blog Archives

xRM Test Framework for Dynamics CRM 2013 is now available

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.

TestBaseClasses

To add the Xrm.Framework.Test assembly to your existing Test project.

  1. In your existing test project – Right click on References -> Manage NuGet Packages…
  2. Click on Online in the left tree and then search for “Xrm.Framework.Test”
  3. Click install – this will add the assembly and the NuGet package to your project

You should be able to see the below:

NuGetXrmTest

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.

  1. Open Visual Studio
  2. From the menu bar click on Tools -> Extensions & Updates…
  3. Click on Online in the left tree and then search for “xRM”
  4. Download and install the extension

You should be able to see the below:

DownloadXrmTestFramework

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.

NewXrmTestProject

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.

NewTest

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.