testing asynchronous code

Tim Fletcher <>
Mon Apr 19 13:56:35 CEST 2010


> Anyone have general strategies or advice for testing code that makes
> heavy use of gen_server:cast? The best I could come up with was to
> write _sync versions of all my functions, with gen_server:cast
> replaced by gen_server:call, and then test those, but that seems both
> clunky and fragile.

How about using a "test spy" process to collect a trace of the cast
messages and then make assertions against the resulting trace?

Tim


More information about the erlang-questions mailing list