114
We would need to get the following capabilities to be able to write better tests:

Mocking procedures, codeunits and other public intefaces like e.g. the Moq-Framework does for C# (https://github.com/moq/moq4).

Mocking web service calls



Please make it possible to mock objects with their global procedures like e.g. the Moq-Framework does for C# (https://github.com/moq/moq4).

 

My motivation is to get a nice test pyramid by writing our tests. But at the moment we tend to become a testing ice-cream cone (https://i.stack.imgur.com/uq7Gh.png )

I think the reason is that the testing framework is really good for UI or integration tests, but in my opinion it does not support unit-tests very much. Why do I think so?

Because I'm not able to mock global procedures to test only the one unit that I want to test at the moment. But in my opinion this is exactly the most powerful advantage of unit-tests:

- They test only the unit - not the integration of units.

- They are fast, because they mock other procedure calls and don't really process the code

- They are easy to write, because I don't have to create test data for procedures that I'm calling

- They are easy to maintain, because they don't have to be modified, just because a called (and mocked) procedure is modified.

- Testing web services or any other C# / platform functionality is very difficult 

Long story short, I would like to have a mocking-possibility.

Category: Development
STATUS DETAILS
Under Review
Ideas Administrator

Thank you for your feedback. We are considering adding it to our longer term roadmap.

Your help is greatly appreciated,
Business Central Team