dotnet core with GenFu

Couple of weeks ago I had to test out the performance of a third party product but in order to test we had to use a lot of logs that would feed into the system. The requirements was to pump out around 1000 logs per seconds and feed into the system.

As you know I am a .NET fan wanted to write this small program in dotnet core C# and was looking for a library that would generate me some fake data but something realistic at the same time. I found GenFu developed by James and Dave, 2 fellow Canadian Microsoft MVP.

The description of GenFu is provided below:

GenFu is a library you can use to generate realistic test data. It is composed of several property fillers that can populate commonly named properties through reflection using an internal database of values or randomly created data. You can override any of the fillers, give GenFu hints on how to fill them.

Installation of GenFu

GenFu comes in NuGet package thus the installation process is as simple as

Usage

My usage was quite simple to generate log files. Thus I started by creating an Object that would contain all my data.

GenFu provides an easy way to fill the data like below

But my requirements had certain criteria and GenFu allows you to use Fillers (PropertyFiller) to fill in data to your needs i.e a way to override its default values. In my case I wanted to override multiple fields, an example below of override of TenantName

With the code above and the setup I was able to generate data that was very realistic to my needs. GenFu also provides Fill to add Ranges to your data or Email addresss like below:

Thanks to GenFu I was able to create some interesting and realistic data to feed into the system. Do check out the library πŸ™‚