How to test side effects on other processes?

That tactic is incredibly useful in all sorts of situations. Unfortunately there isn’t some catchy name associated with it (“Informant function”?).

That is likely due to the fact that there is a range of potential techniques around assert_receive/3, assert_received/2, refute_receive/3 and refute_receive/2 that

  • start simply with the test process injecting it’s pid into the “process under test” to become the recipient of all messages,
  • to the test process launching any number of faux processes (or GenServers) to meet the collaboration needs of the “process under test”.
3 Likes