Test data is a must for all application development to ensure the testing is done under the conditions that closely resemble the production environment. But unfortunately not many times programmers are provided with one. There are lot of libraries like Faker.js and Faker (Ruby) are available but it needs some work on your side (a script) to generate data in the appropriate format and type for your database for testing. Not everyone is a programmer. Mockaroo solves this problem and lets anyone generate up to 1000 records (in free version) in CSV, Tab-Delimited, SQL, JSON, Excel, XML, DBUnit XML and custom formats.
Also it has provisions for automating the generation and download of data via RESTful api. All one need to do is signup using their Google account, create the data schema, and call the Mockaroo REST API from the application. One such example is given below,
copy foo from program 'curl "http://www.mockaroo.com/$KEY/download?count=$COUNT&key=$KEY"' with (format csv, header true);
This script copies the Mockaroo CSV data-set directly in to the postgres table.
The good part of Mockaroo is, the data generated is very real and you can generate anything from ISBN, GUID, Names in Chinese etc. Some of the advance features I like about Mockaroo is listed below,
- Using Regular Expressions to generate data
- Generate image URLs from dummyimage.com
- LinkedIn skills data type
- Custom delimites
- Ruby Math functions to generate data
- SQL Expression Type to add raw SQL to generated insert statements
- Epoch date formats
- Base64 Image URL type
- Client libraries for Node.js (mockaroo-node) and C# (mockaroo.api, NMockaroo)
The only thing I dislike about Mockaroo is, the service is restricted. To download more than 1000 records one need to signup for their Silver (100,000 rows) or Gold Plan (10M rows). By all means I personally think Mockaroo is definitely worth a look and go from there to see what suits one’s need.