We have an application which needs to be tested with a bunch of test data in the MySQL database. For generating random data, we used to run scripts with INSERT statements to generate the dummy data or in some cases wrote stored procedures. We were looking out for a tool which can auto-populate a database with loads of test data based on a schema. As part of the Hackathon project in Qxf2, I took up this task and started exploring. It is when I came across a tool called FillDB.
Why this posts
I spent a good amount of time in figuring out a way to quickly generate random test data into a database. Using FillDB, you can achieve this by just following some simple steps. I thought writing about this tool will be useful for testers who are looking out for such tools. It saves a lot of time and testers can allocate their time in other critical tasks.
To follow along, I assume that the reader of the post is familiar with basic database concepts like database modeling and relational databases.
A brief about FillDB tool
FillDB is a free tool that allows you to generate large volumes of test data in MySQL format and populate databases with random data. Based on the column names and datatype selected it generates random dates, names, addresses. Simply upload the database schema, select tables, define type and format of the data to be generated like foreign key, date, text etc., for each column and it will generate unique test data in different relational tables. For the Hackathon project, I used a schema with two tables employees and departments
Below are the few key features of FillDB:
- Generate Unique user data
- Texts, Paragraphs and sentences
- Date and Time values
- Locations information like countries, city,state
- Foreign key support
- Country and Langauge specific Names/Addresses/PhoneNumbers
- Generate image urls
How to use FillDB
I simply followed below steps to generate data and fill the MySQL database,
1. Submit Database Schema
2. Generate Random Data
3. Export Database with generated data
Submit Database Schema
You can use an already existing schema or create a new schema. There are two ways of submitting an already existing Schema.
If you do not have a schema, you can create a new one using FillDB – DB Generator and follow the instructions given in the page.
Generate Random Data
Next step is to generate the random data. For this, select a table from Current Table drop down for which you want to fill the data and choose what data to be generated for every column. You can follow below steps.
i) Select the type of data for each column. For Eg:- the birthdate field which is of type date, you can choose a format of the date from the Generate dropdown list depending on your requirement.
ii) Define the default parameter values for the column in the parameters columns.
iii) You can use function foreignKey() from the dropdown list and indicate table name and table column as parameters.
iv) Once you finish filling table details, you can define the no. of rows to be generated.
v) If you need country-specific Names/Addresses/PhoneNumbers, you can also choose the country and generate country-specific Names/Addresses/PhoneNumbers.
Once you click on the Generate Data button, you can now see the generated data.
Export Database with generated data
Now you have successfully created some random test data for testing your application, you can simply export this data into MySQL database.
When you Export Database, it automatically downloads a .sql file which you can use for filling the database. You can refer to this link to import a .sql file into the MySQL.
In this way, I was able to create loads of test data into the database by simply uploading a schema. I hope this helps you too in creating custom data for your project needs. Happy DB filling!
References
1. FillDB
2. Import .sql file into MySQL database
I am an experienced engineer who has worked with top IT firms in India, gaining valuable expertise in software development and testing. My journey in QA began at Dell, where I focused on the manufacturing domain. This experience provided me with a strong foundation in quality assurance practices and processes.
I joined Qxf2 in 2016, where I continued to refine my skills, enhancing my proficiency in Python. I also expanded my skill set to include JavaScript, gaining hands-on experience and even build frameworks from scratch using TestCafe. Throughout my journey at Qxf2, I have had the opportunity to work on diverse technologies and platforms which includes working on powerful data validation framework like Great Expectations, AI tools like Whisper AI, and developed expertise in various web scraping techniques. I recently started exploring Rust. I enjoy working with variety of tools and sharing my experiences through blogging.
My interests are vegetable gardening using organic methods, listening to music and reading books.
It has limit of creating data for 100K records only. Is there any other tool which can create data for 50lacs record.
Hi Rahul, You could try using apexSQL for the same. You can find it here: https://www.apexsql.com/sql-tools-generate.aspx
Can you make a post on how to fill column with dummy data numbers
Hi,
In the examples, we have shown where some column takes integers. If those examples didn’t help you Can you tell me what kind of dummy data you expect or want to use it?
Very buggy tool. Tried it several times with no stable results!
how would I generate data for two elements clock_in, and clock_out using DATETIME and offset clock_out to only be 0 years, 0 months, 0 days, 8 hours, ? minutes, ? seconds.
this way the clock_in would be a random DATETIME(‘2020-04-26 05:02:34’) and clock_out under the same row would be DATETIME(‘2020-04-26 13:57:43′) then repeated with this example throughout all generated ’employee_clocks’ table.
Hello James,
Did you try generating dynamic value for clock_out based on clock_in?
please refer this page for more details – https://stackoverflow.com/questions/32788595/select-dynamic-column-based-on-value-of-another-column
define the schema such that the clock_out should generate dynamic value based on clock_in and then Upload the schema from using File Submission option.
Regards,
Raghava
Cna not generate JSON type fields.
Hi,
Looks like FillDB does not support a JSON field, I was not able to generate synthetic data for a JSON field too.
I have contacted FillDB to confirm if this is indeed a limitation.
Hi Djuka,
Thanks for your comment.
I will look into this issue, thanks for reporting it.