A
A
Anton Ivanov2019-05-12 05:30:30
Test Driven Development
Anton Ivanov, 2019-05-12 05:30:30

Should an integration test check whether a model method has been called?

Hello.
My controller method calls a rather complicated (logically) model method. What should the integration test of this controller method check? The fact that the model method is called and the output matches our expectations?
The unit test, of course, will check whether the model method worked logically.
The question is actually in the title. As far as I understand, integration tests can be called "interface tests". That is, it does not matter to them what is inside, they check the correctness of the result.
But what if the controller produces the same result if there was no error and if the model method was not called at all? For example, on error, the controller will return an error, and on success, a status of 204. And if you accidentally delete / comment out the call to the model method, will it also be 204?
If you do not check the fact that the model method was called, then this is a potential error that tests will miss.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question