/
Autokin Generators
Small set of keywords to help in generation of data
In some cases we want to include auto generated data as part of the API request, some of these are emails, ids, names, and maybe passwords. With Autokin Generators, this can be done as well with minimal syntax to understand.
Generate Email Addresses
Scenario: Login to the system
Given that a secure endpoint is up at {host}
Given I set Content-Type header to application/json
Given I set the JSON body to
"""
{
"username": "{generate:email(gmail.com)}",
"password": "p3dr0"
}
"""
When I POST /login
Generate Passwords
Scenario: Login to the system
Given that a secure endpoint is up at {host}
Given I set Content-Type header to application/json
Given I set the JSON body to
"""
{
"username": "[email protected]",
"password": "{generate:any(8,numbers,uppercase,lowercase)}"
}
"""
When I POST /login
This will generate password with length of 8 characters that can be either numbers, uppercase letters, or lowercase letters. If you want symbols just add it from the list.
Generate Names
Scenario: Create Customer to the system
Given that a secure endpoint is up at {host}
Given I set Content-Type header to application/json
Given I set the JSON body to
"""
{
"username": "{generate:emails(gmail.com)}",
"password": "{generate:any(8,numbers,uppercase,lowercase)}",
"firstname": "{generate:firstname(male)}",
"lastname": "{generate:lastname}"
}
"""
When I POST /create
Generators References
GENERATOR | DESCRIPTION |
---|---|
{generate:email(domain)} | Generate random emails, with specified domain name. If not supplied it will have autokinjs.com as email domain. |
{generate:firstname()} | Generate firstname base on existing name list, it can be either male or female. |
{generate:firstname(male)} | Generate male firstname. |
{generate:firstname(female)} | Generate female firstname. |
{generate:lastname} | Generate lastname base on existing list. |
{generate:words(language,suffix)} | Generate random adjective words in English (en ) or Chinese (zh )For example: {generate:words(en,hello)} |
{generate:uuid} | Generate UUID v4. |
{generate:any(length, ...options )} | Generate random characters based on length and options. Options can be numbers , lowercase , uppercase , or symbols .To generate only symbols: {generate:any(10,symbols)} . If you want both numbers and symbols: {generate:any(10,numbers,symbols)} |