Turn your manual testers into automation experts Request a DemoStart testRigor Free

Microsoft Dynamics Testing

Microsoft Dynamics Testing

Microsoft Dynamics is a product line that encompasses a range of enterprise resource planning (ERP) and customer relationship management (CRM) products developed by Microsoft. It includes products such as Dynamics GP (Great Plains), Dynamics NAV (Navision), Dynamics AX (Axapta), and Dynamics SL (Solomon). These individual products were developed separately and targeted different market segments, but they all fall under the umbrella of Microsoft Dynamics. Most of these products now have competent counterparts available in Microsoft Dynamics 365.

Microsoft Dynamics 365 is a suite of Dynamics products that are actively developed and maintained while covering the capabilities of these previous versions of Microsoft Dynamics. It is a cloud-based platform that combines various applications from the Microsoft Dynamics product line into a unified offering. It includes modules for CRM, ERP, human resources, finance, supply chain management, and more. Microsoft Dynamics 365 offers a comprehensive suite of interconnected business applications that can be used individually or integrated together to provide end-to-end solutions for organizations of all sizes.

The products offered by Microsoft Dynamics are commercial and require a subscription and licensing fees to access its features and functionality. The cost depends on factors such as the number of users, the specific modules or applications you require, the level of functionality needed, and any additional services or support you may opt for.

Some popular Microsoft Dynamics ERP and CRM solutions

Microsoft Dynamics provides solutions for managing ERP and CRM operations. Microsoft continues to enhance and expand its Dynamics product offerings to cater to the evolving needs of businesses across various industries. Here are some of the popular Microsoft Dynamics products within the CRM and ERP domains.

CRM Products:
  • Dynamics 365 Sales: Focuses on sales automation, lead management, and customer relationship management functionalities.
  • Dynamics 365 Customer Service: Provides tools for managing customer service interactions, support cases, and service level agreements.
  • Dynamics 365 Marketing: Helps organizations automate and personalize marketing campaigns, lead generation, and customer engagement.
  • Dynamics 365 Field Service: Enables efficient scheduling, dispatching, and tracking of field service technicians for organizations with field service operations.
  • Dynamics 365 Customer Insights: Helps organizations unify customer data from various sources to gain a 360-degree view of customers and drive personalized experiences.
ERP Products:
  • Dynamics 365 Business Central: An all-in-one cloud-based ERP solution for small to medium-sized businesses, covering finance, inventory, sales, and purchasing.
  • Dynamics 365 Finance: A comprehensive cloud-based ERP solution for financial management, budgeting, and financial reporting for larger organizations.
  • Dynamics 365 Supply Chain Management: Covers supply chain planning, inventory management, manufacturing, and logistics to optimize end-to-end operations.
  • Dynamics 365 Commerce: Helps organizations manage end-to-end retail operations, including e-commerce, point of sale (POS), and store operations.
  • Dynamics 365 Project Operations: Enables organizations to manage projects, including project planning, resource management, time and expense tracking, and invoicing.

When would you need to add customizations to these products?

While Microsoft Dynamics products offer a wide range of functionalities out-of-the-box, there are scenarios where writing custom code or developing extensions can be beneficial. Here are some reasons why you might need to write code in Microsoft Dynamics.

  • Customization and Tailoring: Every organization has unique business processes and requirements that may not be fully covered by the standard functionalities provided in Dynamics. Writing code allows you to customize and tailor the system to fit your specific needs. You can create custom entities, fields, workflows, business rules, plug-ins, and user interfaces to align the system with your business processes.
  • Integration with External Systems: In many cases, Microsoft Dynamics needs to integrate with other software systems, such as ERP, CRM, accounting, or third-party applications. Writing code enables you to develop integrations using APIs, web services, or other technologies to ensure seamless data exchange and process automation between different systems.
  • Complex Business Logic: Some organizations have intricate business rules and complex logic that cannot be easily achieved through configuration alone. Writing code allows you to implement and enforce these rules, calculations, or validations within the Dynamics system.
  • User Experience Enhancements: Custom code can be used to enhance the user experience in Dynamics by adding custom controls, improving data entry validation, creating interactive dashboards or reports, or implementing specific UI/UX features to make the system more user-friendly.
  • Industry-Specific Requirements: Certain industries may have specific compliance regulations or industry-specific functionalities that are not covered by the standard Dynamics features. Writing code allows you to develop extensions or customizations to meet those specific requirements.
  • Performance Optimization: In situations where performance optimization is crucial, writing code can help optimize data queries, implement caching mechanisms, or leverage advanced algorithms to enhance system performance.

Testing Microsoft Dynamics

The coding language used in Microsoft Dynamics depends on the specific area or component you are working with. For example, JavaScript is the primary language used for client-side customizations in Dynamics 365 Customer Engagement. For server-side customizations, such as plugins and custom workflow activities, Microsoft provides a .NET Framework-based programming model. This means you can use C# or Visual Basic .NET to write server-side code that interacts with Dynamics 365 Customer Engagement.

X++ is a proprietary language used for coding in Dynamics 365 Finance and Operations. It is an object-oriented language that enables developers to customize and extend the functionality of the application, implement business logic, and handle data manipulation. Dynamics 365 Business Central introduced a new programming language called AL. AL is a modern, declarative language designed specifically for developing extensions in Business Central. It is similar to C/AL (the previous language used in Dynamics NAV) but with added features and enhancements.

Just like the different languages used in the different Dynamics products, there are different test frameworks that are used to test the code. Microsoft's Visual Studio supports most of these test frameworks and provides extensions and utilities to help with testing. Let's take a look at how we can test Microsoft Dynamics via.

Unit Testing

Unit testing is when individual components or modules of a software system are tested independently to ensure that they work as intended. The purpose is to validate that each unit of the software performs as designed. It is typically performed by the developers themselves using a test framework, isolating each part of the program and verifying its correctness. Unit tests are typically automated and are usually written and maintained alongside the codebase. Let's take a look at some of the frameworks supported for unit testing Microsoft Dynamics products.

SysTest Framework

The SysTest framework provides classes, attributes, and methods that enable the creation, execution, and validation of unit tests for X++ code. It includes features such as test case creation, test execution management, assertions, and test result reporting.

To perform unit testing in Dynamics 365 Finance and Supply Chain Management, you typically create test case classes that extend the "SysTestTestCase" class. Within these test case classes, you define individual test methods using the "SysTestMethodAttribute" to mark them as test methods. You can use various assertions, such as "SysAssert::assertEqual" or "SysAssert::assertTrue," to validate expected results within the test methods.

This is how a test method will look in SysTest Framework:
class FMUnitTestSample extends SysTestCase
{
  [SysTestMethod]
  public void testTotalsEngineConfig()
  {
  }
}

Using FakeXrmEasy

FakeXrmEasy is a testing framework designed specifically for Dynamics 365 development. It provides a simulated execution context that mimics the behavior of the Dynamics 365 platform. You can use FakeXrmEasy to write unit tests for your plugins, workflows, and customizations without the need for a live environment.

MSTest

MSTest is a unit testing framework provided by Microsoft as part of the Visual Studio ecosystem. It supports unit testing for various programming languages, including C# and .NET. You can use MSTest to test any managed code components or extensions developed alongside Dynamics 365 ERP solutions. You can use the classes from Microsoft.VisualStudio.TestTools.UnitTesting namespace when writing unit tests.

Below is an example of testing a method of a bank application that is meant to manage withdrawals.
[TestMethod]
public void Withdraw_ValidAmount_ChangesBalance()
{
  // arrange
  double currentBalance = 10.0;
  double withdrawal = 1.0;
  double expected = 9.0;
  var account = new CheckingAccount("JaneSmith", currentBalance);
  // act
  account.Withdraw(withdrawal);
  // assert
  Assert.AreEqual(expected, account.Balance);
}

[TestMethod]
public void Withdraw_AmountMoreThanBalance_Throws()
{
  // arrange
  var account = new CheckingAccount("Jane Smith", 10.0);
  // act and assert
  Assert.ThrowsException<System.ArgumentException>(() => account.Withdraw(20.0));
}

NUnit framework

NUnit is an open-source unit testing framework for .NET applications that is supported by Visual Studio. It provides a rich set of features and assertions for writing and executing unit tests. NUnit can be used to test code that integrates with Dynamics 365 ERP solutions or any custom components built using .NET technologies.

XUnit framework

XUnit is another popular open-source unit testing framework for .NET applications. It follows a similar design and structure as NUnit and provides a range of features for writing and executing unit tests. XUnit can be used for testing code integrated with Dynamics 365 ERP solutions or any custom components built using .NET technologies.

Here is a simple unit test that checks whether the method displays the expected output.
using System;
using Xunit;
using System.IO;

namespace HelloWorldTests
{
  public class UnitTest1
  {
    private const string Expected = "Hello World!";
    [Fact]
    public void Test1()
    {
      using (var sw = new StringWriter())
      {
        Console.SetOut(sw);
        HelloWorld.Program.Main();
        var result = sw.ToString().Trim();
        Assert.Equal(Expected, result);
      }
    }
  }
}

These frameworks can be integrated with your development environment, such as Visual Studio, to facilitate test creation, execution, and reporting. It's important to choose a unit testing framework that aligns with your programming language and development environment. Use the Nuget Package Manager to install packages for the third-party frameworks you wish to use.

Integration Testing

Integration testing is the phase in software testing in which individual modules are combined and tested as a group. Especially with systems integrating with Microsoft Dynamics products, ensuring seamless integration is necessary.

Here are some common scenarios where integration testing is necessary
  • System Integration: When integrating Dynamics 365 CRM or ERP solutions with other systems, such as third-party applications, databases, or external services, integration testing is crucial. It ensures that data synchronization, communication protocols, and business processes between the systems are correctly established and functioning as expected.
  • Data Migration: When migrating data from legacy systems or external sources into Dynamics 365, integration testing is necessary to validate the accuracy and completeness of the data. It ensures that data transformation, mapping, and migration processes are executed correctly, maintaining data integrity throughout the migration.
  • Customizations and Extensions: Dynamics 365 allows for customizations and extensions through plugins, workflows, custom code, or integrations with other platforms. Integration testing is essential to ensure that these customizations and extensions seamlessly integrate with the existing Dynamics 365 system and do not introduce any conflicts, errors, or performance issues.
  • Web Services/APIs: Dynamics 365 provides web service interfaces (such as REST or SOAP APIs) to interact with the system programmatically. Integration testing is required to validate the communication, data exchange, and functionality of these APIs, both when consuming external services or when exposing Dynamics 365 data or functionalities to external applications.
  • Workflow and Business Process Testing: Dynamics 365 CRM and ERP solutions often involve complex workflows and business processes. Integration testing helps verify that these processes function correctly, including the automation of tasks, data validation, approval processes, and system notifications.
  • Reporting and Business Intelligence: Dynamics 365 offers reporting and business intelligence capabilities. Integration testing ensures that the integration between the CRM or ERP system and the reporting tools or data warehouse is correctly set up. It validates the accuracy and consistency of data extraction, transformation, and reporting processes.

Acceptance Test Library (ATL)

The ATL (Acceptance Test Library) is an X++ testing library specifically designed to facilitate the creation and execution of acceptance and integration tests. It proves helpful when having to perform data setup and validations during these types of tests as it lets you create consistent test data, hide the complexities involved in setting up the prerequisites, and also supports the high performance of test cases.

Below is an example of how a test can be created using the ATL:
// Create the data root node
var data = AtlDataRootNode::construct();

// Get a reference to a well-known warehouse 
var warehouse = data.invent().warehouses().default();
  
// Create a new item with the "default" setup using the item creator class. Adjust the default warehouse before saving the item.
var item = items.defaultBuilder().setDefaultWarehouse(warehouse).create();

// Add on-hand (information about availability of the item in the warehouse) by using the on-hand adjustment command.
onHand.adjust().forItem(item).forInventDims([warehouse]).setQty(100).execute();

// Create a sales order with one line using the sales order entity
var salesOrder = data.sales().salesOrders().createDefault();
var salesLine = salesOrder.addLine().setItem(item).setQuantity(10).save();

// Reserve 3 units of the item using the reserve() command that is exposed directly on the sales line entity
salesLine.reserve().setQty(3).execute();

// Verify inventory transactions that are associated with the sales line using the inventoryTransactions query and specifications
salesLine.inventoryTransactions().assertExpectedLines(
  invent.trans().spec().withStatusIssue(StatusIssue::OnOrder).withInventDims([warehouse]).withQty(-7),
  invent.trans().spec().withStatusIssue(StatusIssue::ReservPhysical).withInventDims([warehouse]).withQty(-3));

End-to-End Testing

So far, we have examined the system from the perspective of someone familiar with the inner workings. However, this is not usually the case for end users. They are more interested in using the application as an integrated whole rather than in separate components. For this reason, testing end-to-end scenarios becomes essential. These tests involve interacting with browsers to execute complete workflows, mirroring the actions of an end user. Now, let's explore some tools that are best suited to assist with this task.

Regression Suite Automation Tool (RSAT)

Microsoft's RSAT framework allows you to record and playback test cases using the Task recorder in Dynamics 365 Finance and Operations applications. It captures user interactions with the application and generates reusable test scripts that can be executed automatically during regression testing. RSAT integrates with Azure DevOps for test plans, execution and reporting. The tool is designed to simplify the creation and maintenance of test cases, reducing the effort and time required for regression testing.

EasyRepro

EasyRepro is an open-source UI testing framework provided by Microsoft for automating the testing of Dynamics 365 applications. It is specifically designed for model-driven apps within the Microsoft Power Platform, including Dynamics 365 Sales, Customer Service, Field Service, and other related applications.

EasyRepro leverages the Selenium WebDriver and extends it with additional functionalities to simplify and streamline UI testing for Dynamics 365. It provides high-level API and helper methods that abstract away the complexities of interacting with the UI elements of model-driven apps. With EasyRepro, you can write automated UI tests that simulate user interactions such as clicking buttons, filling out forms, navigating between screens, and verifying expected outcomes. It supports various browsers and platforms, allowing you to execute your tests across different environments.

testRigor

When it comes to automating test cases for Microsoft Dynamics products, traditional approaches tend to be tedious and fail in the long run. These applications use complex UI structures involving dynamic IDs for child windows, deep object trees, and nested iFrames. Since they are web applications, they need to be compatible with different browsers and mobile devices. Moreover, when testing such complex applications, the interactions need to be as life-like as possible to avoid false positives. For example, lookups are used a lot in CRM solutions. While using script formats to interact with these elements, using methods like SendKeys may ignore the maximum limit of the field and create a false positive response.

A simple record-and-playback tool may incur heavy test maintenance costs as Microsoft Dynamics 365 products tend to have releases that regularly introduce changes into the system. On the other hand, using a complete code-based tool may lead to complexities in onboarding, test creation and maintenance, and scalability. This is when having a test automation framework that gives the best of both worlds, like testRigor, comes in handy.

testRigor is a no-code tool featuring an intuitive user interface usable by team members regardless of their technical background. Its test scripts are in plain English, eliminating the need for coded format step definitions. You can organize your test cases into suites for improved clarity. The tool also offers a browser extension, which is a record-and-playback tool generating tests in plain English. You can use this extension to record your steps, then edit the resulting test script to eliminate hard-coded variables. When creating test suites, you can set various configuration parameters, including notification settings, testing type (web, mobile, or desktop), authentication and proxy settings, re-testing options, error reporting, test generation for behavior-driven and crawler-based testing, and multi-browser compatibility.

Support for visual testing makes identifying on-screen elements effortless, without needing to worry about the DOM structure. When writing test cases, you merely need to describe the relative position of the UI element, much like you would when explaining its location to someone else. In this situation, testRigor's AI-based engine carries out the heavy lifting by identifying the UI element based on your description in the test case. This AI engine can alleviate your test maintenance burden. It's capable of recognizing text, images, dynamic pop-ups or banners, detecting if a page appears broken to the end user, and more.

In terms of application UI testing, testRigor offers capabilities such as easy interaction and manipulation of table data, file upload and download, smooth interaction with UI elements like drop-down lists, checkboxes, radio buttons, reusable rules writing support in plain English for repetitive operations, loop operations, performing actions via JavaScript, conditional executions, and various validations. testRigor also supports integration with a range of frameworks and tools, helping you establish a comprehensive development and testing process. Given the importance of data in CRM and ERP systems, testing with data is crucial. testRigor provides the ability to generate this test data directly within the framework or via upload.

Let's consider an example of using Dynamics 365 Finance and Operations to automate the process of creating a purchase order, generating its receipt, and preparing it for invoice creation. This example illustrates how easy it is to record the steps of an end-to-end flow and perform validations at different stages.
login //Pre-defined rule
navigate to Finance and Operations //Pre-defined rule
click on image from stored value "Menu"
click "Modules" below "Workspaces"
click "Accounts Payable" below "Modules"
click "All purchase orders" below "purchase orders"
check that page contains "All purchase orders" above "filter"
click "New" to the right of "Edit"
enter stored value "vendorAccountNumber" in "vendor account number" roughly below "create purchase order"
click "ok"
scroll down until page contains "Purchase order lines"

This example demonstrates why users can create test cases up to 15x faster with testRigor compared to automation engineers using traditional automated tools.

Conclusion

Microsoft Dynamics is a comprehensive solution for businesses to manage their daily operations and resources. With complex systems like Microsoft Dynamics 365 products, having a testing framework such as testRigor, which allows you to concentrate on creating meaningful test cases rather than struggling with other aspects of automation testing like test maintenance, framework setup, and programming knowledge, becomes a necessity.