Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Automated Testing in Microsoft Dynamics 365 Business Central

You're reading from   Automated Testing in Microsoft Dynamics 365 Business Central Efficiently automate test cases for faster development cycles with less time needed for manual testing

Arrow left icon
Product type Paperback
Published in Dec 2021
Publisher Packt
ISBN-13 9781801816427
Length 406 pages
Edition 2nd Edition
Arrow right icon
Author (1):
Arrow left icon
Luc van Vugt Luc van Vugt
Author Profile Icon Luc van Vugt
Luc van Vugt
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Section 1: Automated Testing – A General Overview
2. Chapter 1: Introduction to Automated Testing FREE CHAPTER 3. Chapter 2: Test Automation and Test-Driven Development 4. Section 2:Automated Testing in Microsoft Dynamics 365 Business Central
5. Chapter 3: The Testability Framework 6. Chapter 4: The Test Tools, Standard Tests, and Standard Test Libraries 7. Section 3:Designing and Building Automated Tests for Microsoft Dynamics 365 Business Central
8. Chapter 5: Test Plan and Test Design 9. Chapter 6: From Customer Wish to Test Automation – the Basics 10. Chapter 7: From Customer Wish to Test Automation – Next Level 11. Chapter 8: From Customer Wish to Test Automation – the TDD way 12. Section 4:Integrating Automated Tests in Your Daily Development Practice
13. Chapter 9: How to Integrate Test Automation in Daily Development Practice 14. Chapter 10: Getting Business Central Standard Tests Working on Your Code 15. Section 5:Advanced Topics
16. Chapter 11: How to Construct Complex Scenarios 17. Chapter 12: Writing Testable Code 18. Chapter 13: Testing Incoming and Outgoing Calls 19. Section 6:Appendix
20. Other Books You May Enjoy Appendix: Getting Up and Running with Business Central, VS Code, and the GitHub Project

When to use automated testing?

Enough arguments to convince you why you would want to use automated tests, I guess. But how about when to use them? Ideally, this would be whenever code is changed to show that this functionality, which has already been tested, is still working as it should, to show that recent modifications have not compromised the existing application.

This sounds logical, but what does this mean when you have no automated tests in place? How do you go about starting to create your first ones? Basically, I would advise you to use the following criteria:

  • What code change will give the highest return on investment when creating automated tests?
  • For what code change will your test automation creation improve your test coding skills the most?

Using these two criteria, the following examples of code changes are typical candidates for your first efforts:

  • After go-live bug fixing
  • Buggy code
  • Frequently modified code
  • Business-critical code being changed
  • Code with no or low dependencies
  • Refactoring of existing code
  • New feature development
  • Microsoft updates

After go-live bug fixing

An after go-live bug reveals an omission in the initial test effort that can often be traced back to a flaw in the requirements. Frequently, it has a restricted scope, and, not the least important, a clear reproduction scenario. And by all means, such a bug should be prevented from ever showing its ugly face again.

Buggy code

You have this feature that keeps on troubling you and your customers. Bugs keep on popping up in this code and it never seems to stop. The most elementary thing you should start with is the after go-live bug fixing approach as previously discussed. But, even more importantly, use this code to get started on your first test suite.

Bugs are a particularly useful starting point because they usually provide the following:

  • A defined expectation
  • Steps to reproduce the scenario
  • A clear definition of how the code fails

These are three important elements of automated testing, as you will learn in the next few chapters.

Frequently modified code

One of the basic rules of good code governance is that code should only be changed when it is going to be tested. So, if the code is modified frequently, then the consequence is that it will also be tested frequently. Automating these tests will give a good return on investment for sure.

Business-critical code being changed

Thorough testing should always be the case, but, given the circumstances, it is unfortunately not always doable. Testing changes made to business-critical code, however, should always be exhaustive; that is, try to cover all scenarios of those processes and define a test for each one of them in your automated testing. You can simply not afford any failures on them. Make it a point of honor to find even the two to five percent of bugs that statistics tell us are always there!

Refactoring existing code

Refactoring code can be nerve-racking: removing, rewriting, and reshuffling code. How do you know it is still doing the job it used to? Does it not break anything else? It certainly needs to be tested. But, when manually done, it is often executed after the whole refactoring is ready. That might already be too late, as too many pieces got broken. Before refactoring any code, grant yourself peace of mind and start by getting an automated test suite in place to prove its validity of the original code. To achieve this, define the business scenarios and create tests for each of those scenarios to prove that the current functionality works. With every refactor step you take, run the suite. And again, to show the code is still behaving the same. This way, refactoring becomes fun. We will elaborate on refactoring more later.

New feature development

Starting from scratch and creating a new feature, writing both test and application code, will be an undeniable experience. For some, this might be the ultimate way to go. For others, this is a bridge too far, in which case, all previous candidates are probably better ones. In Section 3, Designing and Building Automated Tests for Microsoft Dynamics 365 Business Central, we will take this approach and show you the value of writing test code alongside application code.

Microsoft updates

Incorporating any update from Microsoft, be it on-premises or in the cloud, your features must be (re)tested to prove they're still functioning as before. In case you do not have automated tests in place, begin creating them. Do this based on the analysis of the various changes and the risks they might entail in terms of introducing errors.

Note

Working on test automation for a new feature will give you the best return on investment. It will lead to a better quality of the code and thus prevent a lot of bugs after go-live/release. But it might be too big a threshold when you start with test automation. Choose one of the above-suggested candidates to start your test automation battle.

You have been reading a chapter from
Automated Testing in Microsoft Dynamics 365 Business Central - Second Edition
Published in: Dec 2021
Publisher: Packt
ISBN-13: 9781801816427
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image