How to mock supervised GenServer during test


I am looking for ways to mock and test supervised process.
If anybody has implemented that, please help share how you did it?


You can always replace that process with another. Could you provide us an example of what you are doing and what problems you have? Because it is hard to tell in general case.

1 Like

I have one process that fetch some credential through rest api. This process is started by supervisor and and want to mock this.

Just start that process in your test directly. Some might provide a start function for this purpose in conjunction of the usual start_link.

perhaps better to mock the http request using something like bypass?