Faker is a pure Elixir library for generating fake data.
-
add
{:faker, "~> 0.17"}
to your deps inmix.exs
:defp deps do [{:faker, "~> 0.17", only: :test}] end
-
run:
mix deps.get
-
add
Faker.start()
totest/test_helper.exs
:ExUnit.start() Faker.start()
-
jump to usage examples.
- OTP 19+
- Elixir 1.6+
See documentation and usage examples.
-
If you get a message like the one below when you call
Faker.Address.city/0
, you need to add:faker
to your application's mix file, in theapplications
function, as above.** (FunctionClauseError) no function clause matching in Faker.Address.city_count/1 lib/faker/address.ex:48: Faker.Address.city_count(nil) lib/faker/address.ex:41: Faker.Address.city/0
Faker was designed as a lightweight library, that's why it can be easily used with other tools.
You can build templates for testing purposes with the Blacksmith project. See the Blacksmith readme for details.
Faker was originally written by Igor Kapkov.
Current list of maintainers:
Do you want to become a maintainer?
See our CONTRIBUTING.md and start contributing today. We usually elect new maintainers based on contributions.
Released under the MIT License.