Elixir: Testing without starting supervision tree
Imagine simple situation: you need to test some of your code modules, but you application is made in the best qualities and traditions of OTP framework. When your tests start, your application starts also, and supervision tree starts also, and everything is running in the same environment with your tests!
Thus, you get a bench of problems:
- Your dev and test environments mix together;
- You can’t test processes, that are registered with names, because they are already started by your supervision tree;
- You can’t perform unit testing, because you are not really sure, that this testing would be really unit.
The solution is simple: Divide and conquer!