Test processes using handle_continue

Is the SUT your process?

  • If yes, and these are unit tests, then my answer is - do not start the server at all. Just call functions and provide your own state directly. In that way you do not have the problem with asynchronous testing.
  • If that process isn’t SUT then mock it by starting different process with the same name
  • If these tests are integration tests then sleep in the test setup and then perform all actions.

Nothing prevents you from instead of using GenServer.call(my_server_pid, :message) use MyServer.handle_call(:message, make_ref(), state).