Fabricator uses conventions to simplify populating common properties. If no custom rules are created for these properties then conventions are applied based on the following table. If you have a property that is semantically the same as a convention but Fabricator doesn't recognise the property name then you can manually invoke the same logic by calling the equivalent generate methods.

Built In Conventions

Type Properties Rule Example Manually Invoked By
String FirstName, GivenName Generate a random English first name Steve GenerateFirstName()
String LastName, Surname Generate a random English last name Anderson GenerateLastName()
String FullName Generate a random English name Steve Anderson GenerateFullName()
String Email, EmailAddress Generate a random, properly formatted, email address GenerateEmail()
String Country Generate a random country Australia GenerateCountry()
Char Initial Generate a random upper-case character from the English alphabet P GenerateInitial()
Integer Zip, ZipCode, PostCode Generate a random number between 10000 and 99999 90210 GeneratePostCode()
DateTime DueDate, DateDue Generate a random date between tomorrow and 7 days into the future - -
DateTime DueReceived, ReceivedDate Generate a random date between 7 days ago and yesterday - -


Property matching for conventions is:
  • case insensitive so 'int ZipCode' and 'int Zipcode' will both have the convention rule for zip codes applied.
  • based on type as well as property name so 'string FirstName' will have the convention applied while 'int FirstName' will not

Custom Conventions

You can add or override a built-in convention with your own custom conventions

Last edited Nov 24, 2010 at 9:42 AM by JRoughan, version 7


No comments yet.