Fake Data for Testing

How are you generating fake data for testing? I usually use popular athlete names and that’s really easy, but what about addresses and phone numbers. Aren’t they horrible? That’s been my experience.

Take a look at Faker gem. It randomly generates “reasonable” fake data. It even has the ability to grab from BS wordlist. To install, run sudo gem install faker and you’re good to go. For me, it failed twice before installing. I’ve noticed that with other gems as well, wonder what’s going on with RubyForge…

To test it, from irb, try this:

require 'faker'
a = Faker::Name
puts a.name

It should come back with a randomly generated name.

It’s a great gem. Have fun with it!

Comments

Leave a Reply

You must be logged in to post a comment.