In the software development process is often a need to test data. Anyway, the programmer needs to make sure that the program will work with the actual amount of data before it will give to the customer. In the case when the amount of data does not matter it will not cause serious problems, but what if that is supposed database table can contain more than 1000000 and more records? How to quickly and easily create test data for this table? This requires a flexible and simple tool capable of quickly generate test data in a useful format for import to the database. The solution to this issue is shown by the example of the data to for the user table
- PHP5 as console applicaion
- Zend_Console_Getopt class for collect of the options
- Scabo_Heap - own library for generate random data
For maximum flexibility, the application is divided into four parts:
- Settings source
- Settings reader
- Result writer
- Result target
Provides configuration information for Settings Reader. It may be anything - file, string, etc.
Reads settings data from the source as some format. So you can implement reader for any format
Converts generated data to the some format and move it to the target. Also you can implement writer to any format.
Writes generated data to somewhere. Usually, it's file, but you can implement any target - directory, string, etc.
Please, put Zend Framework in library directory
- id - increment - unique identifier
- name - string - first name
- surname - string - last name
- dob - date - birthday
- sex - enum(male of female) - gender
- country_id - int - foreign key on country table
- desc - string - description
- active - bool - TRUE if record active, otherwise FALSE
Please, see settings.xml in the root
php run.php --settings-file=./settings.xml --settings-format=xml --output-dir=./output --output-format=csv