Hi all, I will give you some information about random data generator libraries that you can use in your test automation projects. If you have developed automation code, you might have experienced difficulty while creating test data. One can use hard-coded data or randomize the data generation. Hard-coded data is mainly a bad choice because of uniqueness problems that are why random data generation might be a better fit.

Data generation is hard to maintain a good data most have below characteristics:

  • Meaningful
  • Consistent
  • Complete

Let’s think that we have to create a new user on an e-commerce website and we define a “male” user. This user might have below attributes:

Name: Bruce
Last Name: Wayne
Gender: Male
Age: 34
Birth City: Gotham

But what if you need to create a “female” user! You may need to change some fields like “name” and you definitely need to change “gender” because Bruce is a male name. If you don’t change the name according to the gender, you might have meaningless and sometimes inconsistent data in your system.

Those kinds of situation pushed me to look for a solution and I have found some libraries. Below libraries might be very easily integrated into your test automation projects developed with JAVA.

 I will share some examples of Jfairy. It shows you how easy to integrate it with your project.

Those ones can be used for Ruby projects.

Those two can be used for .NET projects

These libraries can help you create many types of data like address, phone number (some libraries can create data according to Locale that you prefer), company, user, orders, etc…

A Final Tip

While choosing the right data generator look for consistency. If your user’s name is Peter Parker, his mail address should be peter.parker@blabla.com, not tony.stark@blabla.com

Some libraries provide that, some don’t.

May the good data be with you.