Skip to content
sheyll edited this page Feb 18, 2011 · 10 revisions

ErlyMock

What is ErlyMock?

ErlyMock is a the current incarnation of an Erlang mocking library inspired by Easymock for java.

It has been battle-proven by a large project, and has many useful features including:

  • any number of modules can be mocked
  • strict expectations
  • allows the definition of stubs
  • implemented with OTP standard behaviour
  • correctly restores cover compiled module
  • it is well documented
  • small, flexible and easy to use API, proven by many, many unit tests
  • comprehensive messages on expectation failures

It is used in unit tests to verify what functions outside the module under test are called by the code under test.

With ErlyMock it is possible to define behaviour and expectations for any erlang module.

Usually unit test functions using mocks follow a specific pattern:

some_test() ->
   % prepare 
   % ErlyMock is quite a long name, and hence 'em' is used

   % run code under test
   % verify expectations

It has undergone many stages and years before reaching this stage. It all started here: http://sheyll.blogspot.com/2009/02/erlang-mock-erlymock.html

How is it used?

How is it installed?

Clone this wiki locally