XrmMockup in action at Power Platform Community Frankfurt

Geschrieben von Roy Carlitscheck am May 19, 2025

Last week it was time again: The Power Platform Community Frankfurt met for the second time. At our first visit it was all about ALM and CustomPages. This time, I had the pleasure of giving a talk introducing XrmMockup - a powerful in-memory testing framework for Dynamics 365 Customer Engagement and a true alternative to FakeXrmEasy.

Power Platform Community Frankfurt is organized by Benedikt Bergmann and Felix Mora.

My session focused on automated testing in Dynamics 365 Customer Engagement, why it's essential, and how XrmMockup helps implement realistic tests efficiently. If you're working with plugins, workflows, or Dynamics 365 Customer Engagement specific business logic, you should know about XrmMockup.

Why automated tests?

Automated tests are not just a checkbox. They help us validate the behavior of our software. Does my plugin still work after I change something elsewhere? Will expected system behavior break because I added or removed something? Especially in complex Dynamics 365 Customer Engagement projects, it's easy to lose track without tests. Automated tests are our safety net. Combined with CI/CD pipelines, they ensure we always know: What works today won't suddenly break tomorrow.

What is XrmMockup?

XrmMockup is an open-source test framework that simulates Dynamics 365 Customer Engagement logic in memory. It completely eliminates the need for a real Dynamics 365 Customer Engagement instance, yet still emulates the most important parts of a CE environment:

  • Complete plugin pipeline incl. images, shared variables, depth, etc.
  • Support for workflows and custom workflow activities
  • Security context (users, roles, teams, business units)
  • Simulation of time-based processes using time jumps
  • Snapshots: store and reset system state at any time
  • Support for CRUD, SetState, Associate, Execute, and more

While the framework works well for classic unit tests, it is specifically designed to simulate and test entire business processes.

Live demo: Testing a plugin with XrmMockup

In the demo, I showed how to integrate and configure XrmMockup in just a few steps within an existing Dynamics 365 Customer Engagement plugin project. I walked through the most important steps and demonstrated them live:

  • Create a test project and add XrmMockup via NuGet
  • Configure MetadataCollector to load Dynamics 365 Customer Engagement metadata locally
  • Write a test that executes a plugin with real data
  • Debug directly inside the test run - no Dynamics 365 Customer Engagement required

The MetadataGenerator can be used to load metadata from an existing Dynamics 365 Customer Engagement instance and is available in the Metadata folder after you install the NuGet package. Security roles, workflows, plugin steps and all important metadata relating to tables, columns and settings are saved locally in an XML file. Here an example configuration:

Example configuration for the MetadataGenerator

It is worth mentioning that you can also specify in the configuration that only certain tables or tables from certain solutions are used.

Setup is quick and the benefits are significant. Once in place, even complex requirements can be tested efficiently. With just a few lines of code, XrmMockup is initialized and ready to use:

Initialize XrmMockup with NUnit

In the InitializeServices method, XrmMockup is initialized with metadata from the Dynamics 365 Customer Engagement system. This is essential so that XrmMockup can understand the system's metadata and correctly handle queries. The BasePluginTypes property specifies the base type of the plugins to be tested. XrmMockup will then automatically detect and execute all plugins that inherit from this type. The plugin steps defined in the Dynamics 365 Customer Engagement metadata are taken into account - so plugins run under the same conditions as they would in a real Dynamics 365 Customer Engagement instance.

After setup, we can start writing tests. It's important to test the logic of the plugin rather than its implementation. That means focusing on what the plugin does in the system, not how it does it. The benefit is that your tests remain valid even when the implementation changes.

Example: Test creating an Account and triggering plugin logic

A great bonus that XrmMockup provides: you can debug directly inside the test run. This is especially useful when developing plugins and can save a lot of time.

Bonus: Readable BDD tests with Reqnroll

As a bonus, I also introduced Reqnroll - a modern BDD framework for .NET based on SpecFlow. In combination with XrmMockup, you can write tests in Given-When-Then format, understandable by both developers and non-technical stakeholders. Besides English, a wide range of other languages is supported - including German. Try it for yourself and read the following scenario and understand what behavior we check here:

Example Reqnroll scenario for inheritance of services

If you read the scenario, you will notice that it is about the inheritance of services of a contract to subordinate companies. This turns a technical unit test into a clear and readable acceptance scenario - perfect for teams where QA, consulting, and development collaborate closely.

Conclusion: Taking testability in Dynamics 365 Customer Engagement to the next level

In my opinion, XrmMockup is currently the most realistic tool for testing Dynamics 365 Customer Engagement logic without a real instance. It's fast, flexible, free, and makes testing fun again. If you want to build Dynamics 365 Customer Engagement solutions that are maintainable and future-proof, XrmMockup is a tool you should absolutely check out.

If you'd like to talk about test strategies for Dynamics 365 Customer Engagement, we'd love to hear from you. Let's connect!

Send message