An overview of Auto Data Generation - New UI

 

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


You can create test cases and generate random data such as names, phone numbers, ages, dates of birth, and emails through ADG. 


Getting Started with Auto Data Generation: 

To generate data automatically, you need to input specific values for given parameters like DataType, Length, Prefix, Suffix, and select options for alphabets, numbers, or special characters. Opkey's ADG then generates the data accordingly. A placeholder gives the visual representation of your data.

 

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.  

 

Once your auto data generation settings are saved, you can use them in your test cases for execution by mapping them to the required test step. 

 

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 

 

Login to the Opkey portal and click on the Tools icon. 

 

 


Select Auto Data Generation. 

 

 


Here, we must generate random Name data with String. 

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

  • Name length: 6 

  • Prefix (First alphabet): S 

  • Suffix (Last alphabet) is O 

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


 




Enter the exclusion values in the pop-up. 


 



Here, we have added letters A and M that will not be included in the blank fields of the placeholder. Thus, alphabets, other than A and M will be visible in the placeholder as well as in the randomly generated data.

If you want to use regex patterns to generate consistent data, you can select the Advanced Regex Pattern and enter it in the Regex field. Next, click the save button as shown below. For example, if you want to generate custom user names containing alphanumeric characters and underscores, with a length ranging from 5 to 15 characters you can use the following Regex pattern: [a-zA-Z0-9_]{5,15}

Here,

  • [a-zA-Z0-9_]: Allows letters (both uppercase and lowercase), numbers, and underscores.
  • {5,15}: Specifies that the length should be between 5 and 15 characters.



 

Using ADG in a test case 


You can follow the steps to use the ADG  in a test case. 

Here we will add ADG  as a random name in a test case, where you require test user registration:- 


Start recording with Opkey Recorder. 

 

Navigate to the user registration page. 

 

Manually enter a first name, last name, email, and password. 

 

Click the "Submit" button. 

 

Stop recording. 

 

Open the recorded test case in Opkey, and you'll see the recorded steps similar to the following screenshot. 

 

Select the Set input data option for the test step where you want to link the auto-generated data. On the "Edit data of step" window that opens on the right, click Data Drive icon under Value. Go to Advance Options. Under the "Parameterize data with" option, select Auto Data Generation from the dropdown. 

 

     

 

Replace the manually entered first name in the test step by the ADG you created earlier. Choose the ADG from the user-defined field and click to map it to the test step. 

 

Save 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 in the placeholder (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 the 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 include +911234567810, +911023456710, +911123456710 & so on. 

 


Follow the steps as stated above to create a test case. Open the recorded test case in Opkey to map the ADG. 


Substitute the manually input phone number with the ADG previously established for generating random data. 

 

Once you've replaced the manually entered data with the appropriate ADG, you can proceed to finalize the test case and execute it. 

 

 


 

3. Generating Age type of random data 

 

Here, we generate random Age data with Integer data type. 

Suppose we must 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 the 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. 

 

Follow the steps as stated above to create a test case. Open the recorded test case in Opkey, to map the created ADG.

 

Replace the manually entered age with the ADG you created earlier for generating random data. 

  

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 must 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 2024-03-06, 2024-03-08, 2024-03-09 & 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. 

 

 

Follow the steps as stated above to create a test case. Open the recorded test case in Opkey, and you'll see the recorded steps in the following screenshot. 

 

Replace the manually entered birth date with the ADG you created earlier for generating random data.  

 

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 from Email (like abc@xyz.com) by fulfilling the following conditions: 

  • Length: 11 

  • Prefix: a 

  • Suffix: .com 

  • Exclusion: d,&,>,?,|,%,$,@,+,_  

  • Allow Lowercase Alphabets: Yes at the 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. 


 

Follow the steps as stated above to create a test case. Open the recorded test case in Opkey, and you'll see the recorded steps. 

 

Replace the manually entered data in the email field with the ADG  you created earlier for generating random data.  

 

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. 

 

You're at the end of the article.


Read on the Use Case of Auto Data Generation 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 at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article