Get List of Data Generator Functions
When creating a Data Model to generate test data, it is helpful to view the list of Data Generator Functions. Alternatively, you can also use Seed Lists and Card Issuers to generate test data, or a combination of all three.
The following parameters are the base parameters required to get data generator functions.
Get Data Generator Functions Response Attributes
Attributes
-
group
stringThe type of this functions, such as text, datetime, special, logical, or numeric.
-
function
stringThe function declaration including parameters and data types.
-
name
stringThe name of the function.
-
description
stringA description of what the function does, accepted values (if applicable), and whether it is an alias (if applicable).
-
example
stringAn example how to use the function.
Get List of Data Generator Functions
curl 'https://tdm.blazemeter.com/api/v1/generator/functions' \
-X GET \
-H 'accept: application/json;charset=UTF-8'
Response200 OK
The following JSON sample provides a more readable version of the content contained in the above curl
example. See also the Test Data Object for details.
Get Data Generator FunctionsGet Data Generator Functions GET Body (JSON)
{
"api_version": 1,
"request_id": "string",
"result": [
{
"group": "string",
"function": "string",
"name": "string",
"description": "string",
"example": "string"
}
]
}
Detailed List of Functions
{
"api_version": 1,
"result": [
{
"group": "text",
"function": "nameGenerator()",
"name": "nameGenerator",
"description": "nameGenerator",
"example": ""
},
{
"group": "numeric",
"function": "sequenceGenerator(start: number = 0)",
"name": "sequenceGenerator",
"description": "Generate sequence number",
"example": ""
},
{
"group": "text",
"function": "randText(minLen: number, maxLen: number)",
"name": "randText",
"description": "Generate random text",
"example": "randText(3, 10) -> \"ATrf3kJ\""
},
{
"group": "numeric",
"function": "addRand(input: number, min: number, max: number)",
"name": "addRand",
"description": "Add random number in specified boundaries",
"example": "addRand(10,1,5) -> 13"
},
{
"group": "numeric",
"function": "randDigits(min: number, max: number)",
"name": "randDigits",
"description": "Returns a random string of digits of a length between minlen and maxlen",
"example": "randDigits(1,5) -> 2103"
},
{
"group": "numeric",
"function": "randRange(min: number, max: number, width?: number)",
"name": "randRange",
"description": "Returns a random integer between min and max. Adds 0 padding to match specified width",
"example": "randRange(10,15,3) -> 013"
},
{
"group": "numeric",
"function": "convBase(input: number, base: number)",
"name": "convBase",
"description": "Convert decimal input to specific base",
"example": "convBase(5,2) -> 0101"
},
{
"group": "text",
"function": "randlov(percnull: number, source: string[])",
"name": "randlov",
"description": "Returns random value from array, perclist function or seedlist",
"example": "randlov(0, [\"one\", \"two\", \"three\"]) -> \"two\"
randlov(10, perclist(\"10%ten\", \"20%twenty\", \"70%seventy\")) -> \"twenty\"
randlov(10, seedlist(\"femalenames\"), 1) -> \"Jenny\""
},
{
"group": "special",
"function": "perclist(values: string[])",
"name": "perclist",
"description": "Represents value list with their percentage probability
Can't be used as standalone generator function. Usable only as RANDLOV generator parameter",
"example": "perclist(\"10%ten\", \"20%twenty\", \"70%seventy\")"
},
{
"group": "special",
"function": "seedlist(seedListName: string)",
"name": "seedlist",
"description": "Represents seed list object
Can't be used as standalone generator function. Usable only as RANDLOV generator parameter",
"example": "seedlist(\"femalenames\")"
},
{
"group": "text",
"function": "percval(values: string[])",
"name": "percval",
"description": "Returns random value from input list. Number of occurrences is affected by probability percentage",
"example": "percval(\"10%ten\", \"20%twenty\", \"70%seventy\") -> \"seventy\""
},
{
"group": "text",
"function": "uuidGenerator()",
"name": "uuidGenerator",
"description": "Returns universally unique identifier (UUID) string",
"example": "uuidGenerator() -> \"660b45c8-f8a8-4929-bb08-da9ad94f389a\""
},
{
"group": "numeric",
"function": "abs(input: number)",
"name": "abs",
"description": "Returns the absolute value of the argument.",
"example": "abs(-5) -> 5"
},
{
"group": "numeric",
"function": "add(valueA: number, valueB: number)",
"name": "add",
"description": "Adds two values together.",
"example": "add(5, 5) -> 10"
},
{
"group": "numeric",
"function": "divide(valueA: number, valueB: number)",
"name": "divide",
"description": "Divides the first number by the second. The function expects integer or floating point numbers",
"example": "divide(6, 3) -> 2"
},
{
"group": "numeric",
"function": "multiply(valueA: number, valueB: number)",
"name": "multiply",
"description": "Multiplies the two numbers",
"example": "multiply(6, 3) -> 18"
},
{
"group": "numeric",
"function": "mod(divident: number, divisor: number)",
"name": "mod",
"description": "Returns the modulo of two numbers. This is the remainder of the first
number divided by the second number",
"example": "mod(5, 2) -> 1"
},
{
"group": "numeric",
"function": "exp(input: number, power: number)",
"name": "exp",
"description": "Returns the natural exponent of a specified number.",
"example": "exp(2, 4) -> 16"
},
{
"group": "logical",
"function": "and(values: boolean[])",
"name": "and",
"description": "Performs a logical AND function on a variable list of arguments.",
"example": "and(true, false, true) -> false"
},
{
"group": "logical",
"function": "or(values: boolean[])",
"name": "or",
"description": "Perform a logical OR operation on a list of Boolean expressions.",
"example": "or(true, false, true) -> true"
},
{
"group": "logical",
"function": "not(input: boolean)",
"name": "not",
"description": "Applies a logical NOT operation to a Boolean expression",
"example": "not(false) -> true"
},
{
"group": "logical",
"function": "booleanCompare(valueA: number|string, valueB: number|string, operator: string)",
"name": "booleanCompare",
"description": "Compares the left and right values using an operator. If left and right values are numbers,
a number comparison is used with the operator and if left or right values are a string,
a string comparison is used.",
"example": "booleanCompare(200, 201, \">\") -> false
booleanCompare(a, c, \">\") -> true"
},
{
"group": "datetime",
"function": "date(input: string, format?: string)",
"name": "date",
"description": "Returns a string as a date.",
"example": "date(\"2018/13/12\", \"YYYY-DD-MM\") -> \"2018-12-13\""
},
{
"group": "datetime",
"function": "datetime(input: string, format?: string)",
"name": "datetime",
"description": "Returns a string as a datetime.",
"example": "datetime(\"2018/13/12 12:12:12.500\", \"YYYY-DD-MM HH:MM:SS.sss\") -> \"2018-12-13 12:12:12\""
},
{
"group": "datetime",
"function": "randDate(min: string, max: string)",
"name": "randDate",
"description": "Returns a random date between the minimum and maximum values.",
"example": "randdate(\"2009/01/01\",\"2010/01/01\") -> \"2009-05-06\""
},
{
"group": "datetime",
"function": "randTime(min: string, max: string)",
"name": "randTime",
"description": "Returns a random time between a min and max.",
"example": "randTime(00:00:00,23:59:59) -> \"12:34:01\""
},
{
"group": "datetime",
"function": "addSecondsToDateTime(input: string, seconds: number)",
"name": "addSecondsToDateTime",
"description": "Adds a number of seconds to a datetime, or subtracts them, if it is a negative number.
Datetime parsing variant",
"example": "addSecondsToDateTime(\"2013-02-08 15:15:15\", -1) -> \"2013-02-08 15:15:14\""
},
{
"group": "datetime",
"function": "addMillisecs(input: string, milliSeconds: number)",
"name": "addMillisecs",
"description": "Adds a number of milliseconds to a datetime, or subtracts them, if it is a negative number.",
"example": "addMillisecs(\"2013-02-08 24:00:00.000\", 160) -> \"2013-02-08 24:00:00.160\""
},
{
"group": "datetime",
"function": "addSecondsToTime(input: string, seconds: number)",
"name": "addSecondsToTime",
"description": "Adds a number of seconds to a time, or subtracts them, if it is a negative number.",
"example": "addSecondsToTime(\"15:15:15\", -1) -> \"15:15:14\""
},
{
"group": "datetime",
"function": "secondsAfter(start: string, end: string)",
"name": "secondsAfter",
"description": "Return the number of seconds between a start and end datetime or time.",
"example": "secondsAfter(\"2013-02-08 09:30:00\", \"2013-02-08 09:30:05\") -> 5"
},
{
"group": "datetime",
"function": "addDays(input: string, days: number)",
"name": "addDays",
"description": "Adds a number of days to a date, or subtracts them, if it is a negative number.",
"example": "addDays(\"2018/12/13\", -1) -> \"2018-12-12\""
},
{
"group": "datetime",
"function": "dow(input: string)",
"name": "dow",
"description": "Returns the day of the week for the date specified.",
"example": "dow(\"2019/19/24\") -> 2"
},
{
"group": "datetime",
"function": "lastDay(input: string)",
"name": "lastDay",
"description": "Returns the last day of the month that the specified date is in",
"example": "lastDay(\"2054/07/04\") -> \"2054-04-30\""
},
{
"group": "datetime",
"function": "daysAfter(start: string, end: string)",
"name": "daysAfter",
"description": "Returns the difference in days between the end date and the start date.",
"example": "daysAfter(\"2000-01-01\",\"2000-01-05\") -> 4"
},
{
"group": "datetime",
"function": "addRandDays(input: string, min: number, max: number)",
"name": "addRandDays",
"description": "Adds a random number of days between the min and max to the date.
If MAX is less than MIN, the value returned is the DATE plus the MIN minus 1",
"example": "addRandDays(\"2000-01-01\", 3, 10) -> \"2000-01-05\""
},
{
"group": "datetime",
"function": "addMonths(input: string, months: number)",
"name": "addMonths",
"description": "Adds a number of months to a date, or subtracts them, if it is a negative number.",
"example": "addMonths(\"2018/12/13\", -1) -> \"2018-11-13\""
},
{
"group": "datetime",
"function": "addYears(input: string, years: number)",
"name": "addYears",
"description": "Adds a number of years to a date, or subtracts them, if it is a negative number.",
"example": "addYears(\"2018/12/13\", -1) -> \"2017-12-13\""
},
{
"group": "datetime",
"function": "time(input: string)",
"name": "time",
"description": "Returns the time portion of a datetime in the project format.",
"example": "time(\"26/02/2008:12:23:22\") -> \"12:23:22\""
},
{
"group": "datetime",
"function": "dob(minAge: number, maxAge: number, input: string)",
"name": "dob",
"description": "Determines a date of birth, given a random age between a minimum and a maximum, on a specified date.",
"example": "dob(4, 99, \"1901-12-08\") -> \"1861-09-18\""
},
{
"group": "numeric",
"function": "elfProef(sequence: string, sign: string)",
"name": "elfProef",
"description": "Find the next 11 proof number from the sequence, + or - for the sign",
"example": "elfProef(\"100000003\", \"+\") -> 100000010"
},
{
"group": "numeric",
"function": "addLuhn(input: number)",
"name": "addLuhn",
"description": "Adds luhn checkdigit to number",
"example": "addLuhn(123) -> 1236"
},
{
"group": "numeric",
"function": "luhn(input: number)",
"name": "luhn",
"description": "Create luhn-compliant number of specific length",
"example": "luhn(4) -> 1236"
},
{
"group": "numeric",
"function": "customLuhn(input: number, index: number, targetLength: number, seedValue?: number)",
"name": "customLuhn",
"description": "Return a valid luhn number by inserting LENGTH 'random' digits after position INDEX",
"example": "luhn(123467897,4,1) -> 1234567897"
},
{
"group": "text",
"function": "length(input: string)",
"name": "length",
"description": "Returns the number of characters in a string",
"example": "length(\"abc\") -> 3"
},
{
"group": "text",
"function": "lower(input: string)",
"name": "lower",
"description": "Return a string in lower case",
"example": "lower(\"ABC\") -> \"abc\""
},
{
"group": "text",
"function": "upper(input: string)",
"name": "upper",
"description": "Return a string in upper case",
"example": "lower(\"abc\") -> \"ABC\""
},
{
"group": "text",
"function": "wordcap(input: string)",
"name": "wordcap",
"description": "Capitalizes a string",
"example": "wordcap(\"hello world\") -> \"Hello World\""
},
{
"group": "text",
"function": "mid(input: string, startPos: number, stringLength?: number)",
"name": "mid",
"description": "Returns a substring starting from the given position, up to the end of the string",
"example": "mid(\"ABCDEFGHIJKL\", 3, 4) -> \"CDEF\""
},
{
"group": "numeric",
"function": "randCreditCard(issuer: string)",
"name": "randCreditCard",
"description": "Returns a random credit card number from various issuers
If issuer allow various card lengths it can be specified with _NUMBER suffix
For example SOLO_18
Supported issuer keys:
AMEX - American Express
CHINAT - China T-Union
CHINAUNION - China UnionPay
DINNERSCLUBA - Diners Club enRoute
DINNERSCLUBB - Diners Club International
DINNERSCLUBUS - Diners Club United States & Canada
DISCOVERCARD - Discover Card
UKRCARD - UkrCard
RUPAY - RuPay
INTERPAYMENT - InterPayment
INSTAPAYMENT - InstaPayment
JCB - JCB
MAESTROUK - Maestro UK
MAESTRO - Maestro
DANKORT - Dankort
MIR - MIR
NPS - NPS Pridnestrovie
MASTERCARD - Mastercard
TROY - Troy
VISA - Visa
UATP - UATP
VERVE - Verve
LANKAPAY - LankaPay",
"example": "randCreditCard(\"MASTERCARD\") -> \"2439709289227044\""
},
{
"group": "csv",
"function": "valueOfCSV(csvFileName: string, columnName: string)",
"name": "valueOfCSV",
"description": "Returns a value of column from a csv. Row number is calculated based on iteration",
"example": "valueOfCSV(\"data.csv\", \"city\") -> \"Prague\""
},
{
"group": "csv",
"function": "valueOfCSVByColumn(csvFileName: string, columnNumber: number)",
"name": "valueOfCSVByColumn",
"description": "Returns a value for column number from a csv. Row number is calculated based on iteration",
"example": "valueOfCSVByColumn(\"data.csv\", 2) -> \"Prague\""
},
{
"group": "numeric",
"function": "randInt(min: number, max: number, width?: number)",
"name": "randInt",
"description": "Alias for function randInt(min: number, max: number, width?: number)",
"example": "randInt(10,15,3) -> 013"
},
{
"group": "datetime",
"function": "dateOfBirth(minAge: number, maxAge: number, input: string)",
"name": "dateOfBirth",
"description": "Alias for function dob(minAge: number, maxAge: number, input: string)",
"example": "dateOfBirth(4, 99, \"1901-12-08\") -> \"1861-09-18\""
},
{
"group": "datetime",
"function": "dayOfWeek(input: string)",
"name": "dayOfWeek",
"description": "Alias for function dow(input: string)",
"example": "dayOfWeek(\"2019/19/24\") -> 2"
},
{
"group": "text",
"function": "randFromSeedlist(percnull: number, seedListName: string, column: number = 1)",
"name": "randFromSeedlist",
"description": "Returns random value from seedlist",
"example": "randFromSeedlist(10, \"femalenames\", 1) -> \"Jenny\""
},
{
"group": "text",
"function": "randFromList(percnull: number, source: string[])",
"name": "randFromList",
"description": "Alias for function randlov()",
"example": "randFromList(0, [\"one\", \"two\", \"three\"]) -> \"two\"
randFromList(10, perclist(\"10%ten\", \"20%twenty\", \"70%seventy\")) -> \"twenty\"
randFromList(10, seedlist(\"femalenames\"), 1) -> \"Jenny\""
}
],
"request_id": "7402d6d8"
}