Skip to content
Adam Lindberg edited this page Jul 24, 2018 · 11 revisions

Welcome to the meck wiki!

Basic Tutorial - A basic tutorial on how to use meck

Release notes

Feature ideas

  • Mock a module only from the perspective of a specific caller (calling process) (#3)

    It should be possible to mock a module so that a set of processes sees the mocked module and all other processes sees the original module.

    • mock:new(mymod, [{restrict, pid()}]):
      • only the caller pid() would hit the mocked module
    • or even better, all pids belonging to a specific application
    • Would enable mocking of the inet, gen_tcp modules etc
  • meck:app (#16)

    This is a feature request for an new function which mocks an application so that you don't have to start all application dependencies when testing an application. i.e.

      meck:app(stdlib).
      ok = application:start(ssl).
    
  • Mock a module only from the perspective of a specific module (#34)

    It should be possible to mock a module only from the perspective of another specific module. This would allow mocking the file module for example, which is not possible due to its use from the code module (resulting in a crash when replacing the module).

  • Deprecate history and provide history digging functions instead (#85)

    Test writers do not need entire history. They need a convenient way to find out some specific facts about the history like called and num_calls functions. By providing them entire history we kind of forcing them to write custom information retrieval and verification functions.

    Perhaps a better way would be to provide a comprehensive set of history digging functions.

  • Add meck:get_state/0, meck:reset_state/0 (#125)

    Export and import of mock states to speed up testing/compilation/runtimes. Needs research!

  • Expect different return values at different times (#147)

    Return dynamic data smarter (based on time, longer sequences, ETS-tables etc.). This can already be done via fun callbacks, perhaps just needs more documentation and examples?