Auto Data Generation

What is Auto Data Generation?

Auto data generation automates data creation, reducing manual input or manipulation. This is beneficial for managing large datasets and simulating scenarios without manual data entry. 

Why there is a need for Auto data generation?

Opkey streamlines data-driven testing by automatically generating diverse datasets. Users can create scripts to generate random data such as names, phone numbers, ages, dates of birth, and emails. 

Getting Started with Auto Data Generation:

To generate data automatically, input parameters like DataType, Length, Prefix, Suffix, and options for alphabets, numbers, or special characters. Opkey then generates the data accordingly. 


You can generate data types like strings, integers, doubles, and date/time values. Alternatively, you can use Panel Heading Name with a regular expression (Regex) to generate auto data. 


After generating data, select it from the Auto Data Generation tab when editing your artifact to use it during 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.

Using ADG in a test case

Now let us suppose that you want to use this ADG of random name in a test case where you need to test user registration with dynamic names. Following are the steps that you can follow :-

  1. Start recording with Opkey Recorder.
  2. Navigate to the user registration page.
  3. Manually enter a first name, last name, email, and password.
  4. Click the "Submit" button.
  5. Stop recording.
  6. Open the recorded test case in Opkey, and you'll see the recorded steps similar to the following screenshot.
  7. Go to the input data field of the test step where you want to link the auto-generated data and then click on the auto data generation icon.
  8. Replace the manually entered first name by choosing the ADG you created earlier for generating random data. (from the user-defined field)
  9. After replacing the manually entered data with the appropriate ADG, you can finalize the test case and execute it. 




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.


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

Using ADG in a test case

Now let us suppose that you want to use this ADG  in a test case where you need to test user registration with dynamic phone numbers. Following are the steps that you can follow:-

  1. Start recording with Opkey Recorder.
  2. Navigate to the user registration page.
  3. Manually enter a first name, last name, email, phone number, and password.
  4. Click the "Submit" button.
  5. Stop recording.
  6. Open the recorded test case in Opkey, and you'll see the recorded steps similar to the following screenshot.
  7. Replace the manually entered phone number with the ADG  you created earlier for generating random data. 
  8. After replacing the manually entered data with the appropriate ADG, you can finalize the test case and execute it.




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.

Using ADG in a test case

Now let us suppose that you want to use this ADG  in a test case where you need to test user registration with dynamic age number. Following are the steps that you can follow :-

  1. Start recording with Opkey Recorder.
  2. Navigate to the user registration page of facebook.
  3. Manually enter a first name, last name, email,birth date,Age and password.
  4. Click the "Submit" button.
  5. Stop recording.
  6. Open the recorded test case in Opkey, and you'll see the recorded steps similar to the following screenshot.
  7. Replace the manually entered age with the ADG you created earlier for generating random data. 
  8. After replacing the manually entered data with the appropriate ADG, you can finalize the test case and execute it.




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.


Using ADG in a test case

Now let us suppose that you want to use this ADG  in a test case where you need to test user registration with dynamic birth dates. Following are the steps that you can follow :-

  1. Start recording with Opkey Recorder.
  2. Navigate to the user registration page of facebook.
  3. Manually enter a first name, last name, email,birth date and password.
  4. Click the "Submit" button.
  5. Stop recording.
  6. Open the recorded test case in Opkey, and you'll see the recorded steps similar to the following screenshot.
  7. Replace the manually entered birth date with the ADG  you created earlier for generating random data. 
  8. After replacing the manually entered data with the appropriate ADG, you can finalize the test case and execute it.

‍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.

Using ADG in a test case

Now let us suppose that you want to use this ADG  in a test case where you need to test user registration with dynamic emails. Following are the steps that you can follow :-

  1. Start recording with Opkey Recorder.
  2. Navigate to the user registration page.
  3. Manually enter a first name, last name, email, and password.
  4. Click the "Submit" button.
  5. Stop recording.
  6. Open the recorded test case in Opkey, and you'll see the recorded steps similar to the following screenshot.
  7. Replace the manually entered data in the email field with the ADG  you created earlier for generating random data. 
  8. After replacing the manually entered data with the appropriate ADG, you can finalize the test case and execute it. 


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



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
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article