19.15 Auto Data Generation
Overview:
Auto Data Generation is an advanced feature in OpKey which enables you to generate random data based on given parameters. The auto generated data can be used across respective artifacts, as required. In order to generate data automatically, you need to provide 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 kind 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 input parameter. Once data is generated, open your artifact, select data from Auto Data Generation tab under data input argument section of the respective keyword. Thus, your auto generated data will be used during test execution of the mapped keyword.
Need of auto data generation?
While working with OpKey, users sometimes need to provide some random data (based on few set parameters) to their test script to automate their application. This feature is very useful in such scenarios where users need to provide randomly generated data as input parameters for test iterations. Now, OpKey is fully capable to generate various types of random data (like name, phone, age, date of birth & email) itself that can be further used as input parameters with other test steps. Thus, you need not to produce required set of random data manually, create GDR or LDR and then map it to the test script.
Getting started with Auto Data Generation:
OpKey allows you to generate some specific type of random data like Name, Phone, Age, Date of Birth & Email. While adding parameters to generate the required data, you need to select the respective Data Type.
Let us see how to generate random data of Name, Phone, Age, Date of Birth & Email type one by one.
- Click on the Auto Data Generation dropdown option showing under the Tools menu on OpKey Web.
Generating Name type of random data
Here, we have to generate random data of Name type with String.
- Name length : 5
- Prefix (First alphabet) : A
- Suffix (Last alphabet) is N
- Middle Alphabet (3rd alphabet) must be in Lowercase.
Generating Phone type of random data
Here, we have to generate random data of Phone type with String data type.
Suppose, we have to generate some random data of Phone 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 showing below:
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: 25
- Max Number: 75
Select Integer from the Select Data Type dropdown option.
The added parameters in the pattern are as showing below:
In this way the generated random Age data maybe like 25,28,30, 31, 32, 33 & so on.
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 23 and Increment as 2.
In this way the generated random Age data maybe like 25, 27, 29, 31 & so on.
Generating 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: 2012-08-01
- Max Date : 2018-10-31
Select DateTime from the Select Data Type dropdown option.
The added parameters in the Random Date Pattern are as showing below:
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,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,a,~,!,#,$,%,^,&,*,(,),_,+,{,},|,:,”,>,?,/,.,,,’,;,\,],[,=,-,`,
- Allow Lowercase Alphabets : Yes at 1st, 2nd, 4th, 5th & 6th place of placeholder. Copy Beta & paste it as 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.
Select String from the Select Data Type dropdown option.
The added parameters in the Default Pattern are as showing below: