Tuesday, December 8, 2015

Generate your test data

Over the years I used multiple tools to generate test data. Most the time I ended up creating some useful test data by hand or automatically generating random “gibberish”. Last week I discovered GenFu with has the following promising tagline “Awesome Test Data”.

image

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.

For the following Person class…

image

…combined with one line of code…

image

…it generates the following test data…

image

Looks like magic to me! I’m going to try it out for my next set of unit tests…

No comments: