This guide is incomplete and in active development. Visit the API docs for an accurate view into faux


faux is a library to create mocks out of structs.

With faux you can stub the behavior of your structs during tests, thus allowing you to write readable and maintainable unit tests.

Mocking is a powerful technique to write repeatable unit tests. Mocks let you focus on a particular system or component by mocking the dependencies underneath that may be hard or not valuable to setup in your unit tests. These kind of tests are not meant to replace higher level tests that would verify the correctness of your application as a whole.

This book is split into two sections: a guide for using faux, and an appendix of blog posts regarding faux.

More Information

For a deeper dive into the api of faux, you can read the API docs. faux is open source and it is available under an MIT License in github.