faker
A library for generating fake data such as names, addresses, and phone numbers.
A Ruby library that generates realistic fake data, names, emails, addresses, credit cards, and more, for filling test databases, writing automated tests, and building demos.
Faker is a Ruby library that generates realistic-looking fake data for use during software development. You include it in your project, call a method like Faker::Name.name or Faker::Address.full_address, and get back a plausible but made-up name, address, phone number, or other value. Developers use it to fill databases with test data, create realistic demos, or write automated tests without relying on real personal information.
The library covers a wide range of data types. You can generate names, email addresses, passwords, street addresses, ZIP codes, job titles, credit card details, dates, random strings, and more. There are generators for internet data, finance fields, locations, and even programming language names. The full list of generators is documented separately and runs to dozens of categories.
Faker also supports two useful modes for testing. If you need every generated value to be different from the last, you can call Faker::Name.unique.name and the library will track what it has already returned. If you need the same values to appear every time a test runs, useful for reproducible test output, you can seed the random number generator with a fixed value and Faker will produce the same sequence on each run.
The library supports over 40 language locales. Setting the locale to Spanish or French, for example, will make names and addresses look appropriate for those regions rather than defaulting to English-language formats.
One caution the project itself flags: because Faker generates data at random, it may occasionally produce strings that happen to match a real person's name, email, or address. It is not designed to guarantee that its output is fictitious in every case, so teams working with sensitive contexts should keep this in mind.
Where it fits
- Seed a development database with thousands of realistic-looking but fictional user profiles.
- Write automated tests that need plausible input data without touching real personal information.
- Generate reproducible test fixtures by seeding the random number generator so the same values appear on every test run.