Question

A quick one, I am looking for a tool for data generation. I have an entity with dates; the date it was made, a start date and an end date. I want the data generation to take care of this constraints:

  1. made maybe today or some day after
  2. start maybe equal to made but not before
  3. end maybe only be a day after start or any other date after start

I looked at http://generatedata.com and http://mockaroo.com, but they didn't have a way i could maintain the constraints. I just need that constraint, but not sure which softwares to try to maintain these constraints. I just need quick data to test my application. thanks

and just a by and by, have you ever been in such a situation where what you need you can't find?

Was it helpful?

Solution

benerator is the tool to use, which is is very flexible though one needs to learn it pretty fast. with my above situation, in the xml file for benerator (that's what it uses ), i just write the following and i'm good to go. in fact, i can even now put ranges for made, start and end dates. This is a section of a generate tag for 30 records of an entity (let's call it MY_ENTITY) with those dates

<import class="org.databene.commons.TimeUtil"/>

<generate name="MY_ENTITY" count="30" consumer="ENTITY_OUT">
    <attribute name="MADE_DATE" type="date" script ="TimeUtil.today()" />
    <variable name= "for_startDate" type="int" min="0" max="10" />
    <attribute name="START_DATE" type="date" script="TimeUtil.addDays(this.MADE_DATE, 
         for_startDate)" nullable="false"/>
    <variable name="for_endDate" type="int" min="1" max="10" />
    <attribute name="END_DATE" type = "date" script="TimeUtil.addDays(this.START_DATE, 
         for_endDate)"  nullable="false"/>
</generate>

and benerator supports many databases through JDBC, and it comes loaded with several JDBC drivers. try it here http://bergmann-it.de/test-software/index.php?lang=en. it's open source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top