How to generate mock/testing data?

LAI TOCA
2 min readAug 8, 2019

--

Photo from https://saramorgan.net/2015/07/01/best-way-to-generate-lots-of-fake-test-data-for-force-com-orgs/

Generate sample data for unit, integration or even pressure test are usually as routine tasks for each engineer or data scientist. We could build those data manually from converting real data from existing database. Or we could choose library that did almost everything for us, the article introduce how to make time-consuming things more simple.

First, download and install Bogus:

NuGet Bogus
Bogus help create seeding within ease and intuition way.

Here are the sample how to generate mock/testing record(s) through Bogus.

Assume that we would like to make some member records for building contact list.

And the result as below:

Member records

That’s it. With fewer lines of code our sample data generated!😊

Reference

--

--

LAI TOCA
LAI TOCA

Written by LAI TOCA

Coding for fun. (Either you are running for food or running for being food.)

No responses yet