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.

About these ads

Posted on March 25, 2014, in CRM 2013, Dynamics CRM, xRM Test Framework and tagged , , , , , , , , , . Bookmark the permalink. 3 Comments.

  1. Does this support Visual Studio 2012? My CRM 2013 plugin project is using the CRM 2013 Developer Toolkit. I installed the nuget package as outlined, but I don’t see the new project template. I’ve tried restarting Visual Studio, but no luck.
    I also looked at installing the NuGet packages for the Moq and Fakes, but they require .NET 4.5. This confuses me, because I didn’t think you could build CRM 2013 plugin assemblies for .NET 4.5, so I wonder where I’ve gone wrong.

    • Hi Larry,

      You need to install the productivity tools (xRM Test Framework) from the visual studio gallery to see the project and item templates. NuGet libraries only give you the base classes.

      With regards to .net version. Good question. Basically your plugin and workflows should 4.0 as required by CRM. However the Test projects can be 4.5 so you can use fakes and these don’t need to be deployed to CRM. They will run on your workstation and build or test servers that should have .net 4.5 installed.

  2. Reblogged this on Kasper's CRM Blog and commented:
    Wael Hamze has created a cool xRM Test Framework that has really caught my attention. It looks awesome! Especially the use of Microsoft Fakes to test plugins looks promising.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: