A few days ago, we upgraded our product from 17.0 to 17.1. We had been looking forward to this release, because we usually never release a product or customer on an RTM release of Business Central. So .. finally 17.1, finally we could continue to upgrade the product and start releasing this to customers before the end of the year. While this was just a minor upgrade .. things started to fail. We have quite some apps to build, and some of them had many failing tests.
All these failing tests for just a minor upgrade? That never happened before.What happened? Well …
You are probably aware of the new “feature” in Business Central, called “Feature Management“. A new functionality that lets users enable upcoming features ahead of time. It indicates which features are enabled, when they would be released, and it gives you the possibility to enable them in a certain database (usually a demo or sandbox to test the feature).From 17.1, Microsoft enables 5 of these features out-of-the-box in the Cronus database that comes with the DVD or Docker Artifact.
Now, these features is business logic. So, by enabling them, you’re going to enable new business logic. New business logic in an upgraded database means: a difference in behavior. A difference in behavior in a database with a crapload of tests, usually means …
Exactly: DevOps will execute your tests against a new Cronus database where these features are enabled, so your tests will fail, your pullrequests will fail, … basically your developments will come to a halt :-).This needs immediate attention, because before being able to continue development/testing/.. this needs to get fixed.
My first focus was looking at the cause of these failing tests: “a changed database with new business logic, features that are actually still not really released, just part of the database as an upcoming feature. So, how can I change my docker image to be a correct one with correct enabled features??”. Or in other words: I was looking at docker to solve this problem.
It was actually a remark from Nikola Kukrika (Microsoft) on my twitter thread that made me look at it from a different angle. Sure, my tests fail because of the enabled features. But this is actually good and useful information: they tell you the current business logic is not compatible with the upcoming feature, and I should also indicate that in code by disabling the feature during the tests. Doing so, I actually also give myself a “todo-list” and a deadline: all disabled features need to get enabled (or in other words: I need to make my software compatible with the upcoming version of the business logic) – and even more: it will fail again from the moment the features are actually released. So you kind of get warned twice. Looking at it from this angle: you WANT these failing tests during an upgrade.
Luckily, disabling the tests wasn’t so difficult. This is what we did:
And tests are working again :-)!