Automated Testing for Microsoft Dynamics NAV and Business Central
If you have Microsoft Dynamics NAV or Business Central, you might have heard that Microsoft offers automated test scripts. In fact, you might be surprised to learn that Microsoft has been creating automated test scripts since 2016. The current count is 40,000+ automated test scripts—which are free to use—and Microsoft is constantly adding more. The concept is becoming more compelling and is being used more often because Microsoft has been encouraging the use of automated test scripts, and partner and users are discovering the benefits of utilizing this methodology.
At ArcherPoint, we’re big proponents of automated testing. We use it in our work with clients and recommend it to everyone. In this blog post, we provide a definition of automated testing and discuss the advantages of investing in it.
What is Automated Testing?
It is very easy to define “automated testing” because the name describes it; automated testing involves automated test scripts that allow you to test functionality within Dynamics using a specific type of coding construct provided by Microsoft. This construct allows you to run tests against a database, regardless of whether that database contains data.
Automated testing lets you test anything—not just functionality—including external integrations, printing outputs, web service calls, and pages (user interface testing), and you can test anything as many times as you like. For example, you can test a transaction—like posting a sales order—as many times as you like without compromising the system. You get a repeatable way of testing that rolls back all the transactions when the test is complete.
Why Microsoft Encourages Automated Testing
Over the past several years, Microsoft has fundamentally changed the structure of Dynamics 365 Business Central, essentially “decoupling” customizations from the base code. This allows customers and partners to implement customizations that don’t break the base application code. This isolation also allows us to test our customizations much easier.
In addition, writing and deploying code in Business Central today isn’t necessarily more difficult, but there is a discipline behind it that, as mentioned earlier, makes it more compelling to use automated testing to ensure programmers are delivering clean code. This is called test driven development.
Simply defined, test-driven development is an approach to programming in which developers test freshly written code before adding it to your system. They can either write all the code for the requested modification, test it using automated test scripts, and then deploy it, or they can break the project down into segments, writing code for a segment, pausing to test that code with automated test scripts, then moving on to the next segment and repeating the process. Test-driven development is very smart and is destined to become a best practice because it saves time and errors—ultimately resulting in cleaner code. Again, although it doesn’t affect you directly, it is something to be aware of, so you better understand the importance of using automated testing.
How Automated Testing Works
The concept of automated testing is simple, but with powerful results. Each script is written to test a specific thing (functionality, report output, etc.) and has a format to accommodate that specific test. The general structure is straightforward: Given, When, Then. Given a certain scenario where X happens when Y happens then Z should be the output. In the Microsoft world of automated test scripts, if the test is successful, the script returns a green light for “success”. If not, you get a red light for “fail”.
When to Use Automated Testing
Automated testing should be used any time you would ordinarily test something manually:
- Any time a change is made to code, no matter how small the change might be—and regardless of whether you made the change or Microsoft made the change, to ensure their changes did not break anything in your system
- Before go-live after an upgrade
To clarify, Microsoft’s base application code for its ERP products is included in the provided test scripts; Microsoft tests all their code before releasing it. Customers or their partners can also extend these scripts or create their own scripts to test customizations. Microsoft also provides libraries that can be leveraged to speed up testing, enabling easier creation of vendors, posting setups, items, and so forth.
If that 40,000+ number mentioned at the beginning of this post sounded like an awful lot of testing to deal with, keep this in mind: It only takes about five hours to run each and every one of the 40,000+ tests on a fast system in Cronus, and their code coverage is nearly a hundred percent.
Customers (or their partners) run all these tests, along with the tests they (or their partners) have created for their own customizations as well as those provided by ISVs for the add-ons they’re using. So, when Microsoft releases a cumulative update, whether or not you've made any customizations since the last cumulative update, you (or your partner) run the test scripts to make sure your customizations still work with new code introduced by Microsoft in the update. However, you don’t need to run every Microsoft test, only those that are testing your customizations. In short, even if your customizations are complex, it takes less than an hour—typically far less—to run the tests you need to run.
The Benefits of Automated Testing are Many, with No Real Downside
The benefits of automated testing over manual testing for Dynamics 365 Business Central users are many:
- It saves time. Manual testing requires human interaction, while automated testing is just that—automatic. Think machine speed versus human speed. In fact, automated testing can reduce the amount of time it takes to test by at least one third.
- It makes it very easy to test your data on the latest release to see if any code breaks and if so, which code, to help determine the level of risk with upgrading to the latest version.
- It results in a reduction of errors that are typical with manual testing—even if you are a super-ninja tester, you are human and can miss things and make mistakes!
- It reduces risk and surprises at go-live with upgrades or when deploying changes of any kind
- It means less disruption. By uncovering errors early, before go-live, you take care of the problem now instead of down the road. The longer you use the system with a problem, the greater potential for bad data to be generated that will have to be cleaned up.
- As an existing, long term, customized customer moves toward more “code coverage”, testing is less of a burden, to the point that an upgrade will be more like an operating system update.
Possible “Downsides” (But Not Really)
Is there a downside to automated testing? There are two factors that bear mentioning, but we at ArcherPoint do not see either of them as a downside:
First, there is an initial investment for companies on a customized version of Dynamics NAV or Business Central. This comes in the form of the cost of writing test scripts for your customizations. However, there is a point in time (see Figure 1) where this investment starts paying off and automated testing becomes “routine”. While it might seem financially advantageous to stay with manual testing because it’s cheaper in the short term, it’s important to understand that this is temporary. As your company grows, your ERP system will grow and change, requiring more customizations and more manual testing, which will cost more and increase the risk for errors and downtime.
Automated testing is a very wise investment that will pay off quickly and will keep on paying off. Investing in automated test scripts right now can significantly reduce testing time for all future updates. With estimates that automated tests run 5 times faster than manual and the cost dropping dramatically as more upgrades come your way because you save the cost of manual testing each time, the payoff is going to be big and well worth the initial investment, especially in a reduction of disruption in the testing phase of your ERP projects. Not to mention, the ability to stay current on the latest version due to less disruption (less manual testing)!
Figure 2 – Costs over time when investing in automated testing - credited to Abstracta
A second factor to keep in mind is regarding change. With any change, there are always some challenges with adoption. While not universal, some people have difficulties letting go of doing things the “old” way. It creates uncertainty in some, and with others some mistrust. It’s anxiety provoking to let go of a certain amount of control. A developer who is experienced and is very good at testing code or troubleshooting problems could, understandably, be hesitant about adopting a new process. Like any shift in a way of doing things, it is advisable to put a change management plan in place. Ultimately, it is worth the investment because it will pay off in the future.
I'd love the opportunity to talk to you about the benefits of automated testing - especially about how it can greatly impact your ability to stay current on Dynamics 365 Business Central. Contact ArcherPoint to learn more!
- Login Error: Communication protocol mismatch between client and server
- Creating a Date Table in Power BI
- The Top Eight KPIs Retailers Should Be Tracking (with Formulas) for Your Retail KPI Dashboard
- Difference Between IaaS, PaaS, and SaaS And When You Need to Use Them
- The Microsoft Technology Stack – What It Is and Why You Should Care