Auto Data Generation

What is Auto Data Generation?

Auto data generation involves automating the process of creating data, eliminating the need for manual entry or manipulation.  It's particularly useful when dealing with large datasets or when you need to simulate different scenarios without manually inputting each individual piece of information. 

Instead of manually inputting or defining each piece of data, with the auto data generation feature we can generate data automatically based on predefined rules, algorithms, or patterns. 

Why there is a need for Auto data generation?

In Opkey, data-driven testing is simplified by automating the generation of diverse and relevant datasets. Users can leverage Opkey's capability to create scripts for generating random data, such as names, phone numbers, ages, dates of birth, and emails. This automation is particularly beneficial when dealing with a large volume of data or aiming for comprehensive test case coverage. Opkey allows users to seamlessly integrate randomly generated data as input parameters for test iterations, eliminating the need for manual dataset preparation.  

Getting Started with Auto Data Generation:

In order to generate data automatically, you need to provide a few inputs as parameters (like DataType, Length, Prefix, Suffix, Exclusion, Allow Alphabets, Allow Numbers, Allow Special Characters, etc.) based on which data are generated. You can generate various kinds of data like String, Integer, Double & DateTime. Panel Heading Name is another way of generating auto data in which you need to provide Regex as an input parameter. Once data is generated, open your artifact, and select data from the Auto Data Generation tab under the data input argument section of the respective keyword. In this way, your auto-generated data will be used during the test execution. 


Let us learn how to generate random data of Name, Phone, Age, Date of Birth, and Email type one by one.

1. Generate a Name type of random data

  • Click on the Auto Data Generation dropdown option showing under the Tools menu on Opkey Web.


Here, we have to generate random data of Name type with String.

Suppose, we have to generate some random data of Name by fulfilling the following conditions:

  • Name length: 6
  • Prefix (First alphabet): V
  • Suffix (Last alphabet) is L
  • 3rd alphabet must be in Lowercase.


The First step is to add a Name and Select String from the Select Data Type dropdown option.


The added parameters in the pattern are as shown below:




Click on the Exclusion button to add the alphabets that you don’t want to add in the blank fields of Placeholder


Here, we have added V & L that will not come at the blank fields (2nd & 4th place) of the placeholder. Thus, alphabets, other than V & L will come at 2nd & 4th place of the placeholder as well as randomly generated data.

Allow Lowercase Alphabets: At the 3rd place of placeholder. Copy Beta & paste it at the respective place.

In this way, the output (generated random data) may be like VIsHAL, VFjSKL, VIkSSL, VixlhsL & so on.

2. Generate Phone type of random data

Here, we have to generate random data of Phone type with String data type by fulfilling the following conditions:

  • Phone number length: 13
  • Prefix (First alphabet) : +91
  • Suffix (Last alphabet) is 10
  • All blank fields (4th, 5th, 6th, 7th, 8th, 9th, 10th & 11th) must be the Numbers only.
  • Click on the Copy Gamma button and then paste it to all respective fields in the placeholder (optional).
  • You can leave blank :4th, 5th, 6th, 7th, 8th, 9th, 10th & 11th fields in the placeholder as Allow Numbers checkbox is marked which will allow numbers only.


Select String from the Select Data Type dropdown option.

The added parameters in the pattern are as shown below:




In this way, the generated random Phone data may be like +911234567810, +911023456710, +911123456710 & so on.

3. Generating Age type of random data

Here, we have to generate random data of Age type with Integer data type.

Suppose, we have to generate some random data of Age by fulfilling the following conditions:

  • Min Number: 28
  • Max Number: 40


Select Integer from the Select Data Type dropdown option.

The added parameters in the pattern are as shown below:



In this way, the generated random Age data may be like 28,30, 31, 35, 37 & so on.

NOTE:- Sequential Number Pattern is another way of generating random data of Age type.

  • Select Sequential Number Pattern and enter Min Number and Increment.
  • Suppose, here we have entered Min Number as 28 and Increment as 2.







In this way, the generated random Age data may be like 30,32,34,36 & so on.


4‍. Generate Date of Birth type of random data


Here, we have to generate random data of Date of Birth type with DateTime data type.

Suppose, we have to generate some random data of Date of Birth by fulfilling the following conditions:

  • Min Date: 2023-11-22
  • Max Date: 2023-12-22


Select DateTime from the Select Data Type dropdown option.

The added parameters in the Random Date Pattern are as shown below:


In this way, the generated random Date of Birth data may be like 2023-11-24, 2023-11-25,  2023-12-06 & so on.

NOTE:- Random DateTime Pattern is another way of generating random data of Date of Birth type.

Select the Random DateTime Pattern radio button and choose the date and time from the calendar (Eg. 2017-08-01 00:00:00).


In this way, the generated random Date of Birth data may be like 2023-11-24 00:00:00, 2023-12-06 00:00:01,  2023-12-09 00:00:03 & so on.


‍5. Generating Email type of random data

Here, we have to generate random data of Email type with String data type.

Suppose, we have to generate some random data of Email (like abc@xyz.com) by fulfilling the following conditions:

  • Length: 11
  • Prefix: a
  • Suffix: .com
  • Exclusion : d,&,>,?,|,%,$,@,+,_ 
  • Allow Lowercase Alphabets: Yes at  2nd, 5th, 6th & 7th place of placeholder. Copy Beta & paste it at the respective places.
  • Allow Special Character: Yes At 4th place of placeholder i.e. @ only (other than the special characters added in Exclusion). Copy Delta & paste it as the respective places.
  • Allow Numbers: Yes At 3rd place of placeholder. Copy Gamma & paste it at the respective place.


Select String from the Select Data Type dropdown option.

The added parameters in the Default Pattern are as shown below:



Thus, the generated random data (output) will be like acb@xyz.com, adb@xyz.com, ade@adf.com, and so on.

NOTE:- After creating every auto-generated data, save it to the database by using the save icon.

How to Link the auto-generated data with a test case

Go to the input data field of the test step where you want to link the auto-generated data and then click on the icon shown below.




Now choose the user-defined field name that you want to link with the respective test step.






Now you have successfully learned how to use the Auto Data Generation feature.

Explore more Opkey features by clicking Here. 


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article