4 ms·
You're right, it's not unit testing. I call it integration testing, some people call it functional testing. The question is why you want to test that one class
by rkangel 6y ago
You're right, it's not unit testing. I call it integration testing, some people call it functional testing.
The question is why you want to test that one class? We do have some modules in our (elixir) system that are 'thoroughly' unit tested. These are modules that are algorithmically complicated so testing them in isolation is useful. Most of the code is tested in logical chunks though.
- swat535 6y agoI think this is what OP is saying, you need _both_ unit and integration tests. In unit specs you should use mocks/fakes for external behaviour. Then you can simply verify that it's calling the dependency correctly. Isolation specs are useful because when integration tests fail, they usually give little feedback as to what exactly went wrong in the system. Also integration specs are expensive and slow to run since they execute everything. Finally I think mocks/fakes are useful because if you find yourself mocking 20 objects to get a single unit test working, then it's a sign that you need to redesign the code.