Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Use Faker.NET To Fake Your Data

Use Faker.NET To Fake Your Data

This item in japanese

Faker is an open source C# port of the Ruby Faker gem mainly used to easily generate fake (but presentable) data – names, addresses, phone numbers, etc. Handy, whether its for demonstration purposes or for creating test data.

How does it work? A look inside the code shows how – the solution contains resource files with possible good values for each of the attributes (for eg. First Name, Last Name, etc) and code randomly mixes and matches these to generate the data. The more the pre-fed values for each of these attributes, the more combinations are possible and hence richer the data. Depending on your specific needs, you might want to modify the resource files to reflect the data you need (for instance, names or addresses localized to a particular region). An article from Ollie Riches shows a quick usage of the library.

The utility is compatible with .NET Framework 4.0, Silverlight 3-5 and Windows Phone 7.0 and 7.1. It is available as a NuGet Package.

There is another GitHub project with the same name (Faker.NET) that seems to work in the same way except for a couple of things – the possible values are directly in the C# code (instead of resource files) and it has an additional class for Education (Degree, Major, School, etc).

Rate this Article