Having worked as a software test (automation) consultant on various development environments for the last five years, and having (very) recently made a move to the world of Mendix, I can't help to get the (surprising) idea that very few Mendix developers actively use unit tests. This could hardly be more different than what I have experienced in the projects I've previously worked on, where unit testing was a given. This appears to be completely different in a Mendix environment. I know there is a module in the App store for unit testing, but why is it not common practice? Or is it, and am I misinformed? Of course, when you develop in Mendix, you use a lot of standard building blocks, of which you could say that they don't have to be tested separately. I've also learned that the Mendix modeler itself covers a lot of possible problems that can arise in microflows, where it checks for inconsistencies and incomplete (decision) paths. But that seemingly only covers part of the technical errors that can arise, not the functional ones. Microflows may contain logic, which in my experience would make them prime candidates for unit tests. If it is possible to isolate them from the context (no dependencies or only mocked ones), that is, otherwise it wouldn’t qualify as a unit test at all. Who can enlighten me on this matter? Why are unit tests so scarcely used in Mendix, or aren't they? Why does this situation differ so much from 'traditional' development environments (Java, .Net, etc.)?
Joris van der Heijden
I agree with your observation Joris and I have multiple explanations:
A Mendix application is directly tied to the database so compared to Java and .NET there's no abstraction or ORM you can bypass in your tests.
A Mendix application is one big bad blob, so when your application grows and the amount of unit tests grow in the same pace it becomes to large to handle in the Modeler.
The typical Mendix developer does not work in a team where modern paradigms like unit testing are standard practice.
Mendix developers focus on delivering immediate visible value to the product owner/business.
I seriously doubt if unit testing is in any Mendix training course at all.
Mendix is marketed as a happy pink Little Pony and all you need to focus on is the business. But if you want to build serious applications with serious quality to deliver serious services then you need to take it serious.
I mostly agree with Paul (I like number 6), but here is an additional thought on that:
Unit Testing is not a first-class citizen in the Mendix integrated platform. It should be fully integrated in the platforms development, build and deployment process. With the module you still have to invest much time to properly integrated with that. This is somewhat the opposite of the mendix philosophy.
It really 'feels' hard to do unit testing in mendix. And while developing in an area where requirements quickly change and features sometimes become obsolete just after they are deployed, you really think if the hours spend on unit testing are worth it.