Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Data Generator APIs

The Data Generator APIs create random test data such as text, phone numbers, numbers, email addresses, dates, and booleans, for use anywhere in a script.

Modes BrowserWindowsJavaAndroidiOSSAP

Generates random text data based on the given parameters.

Parameters

NameTypeDescription
$prefixstringoptionalText to prepend to the generated value
$minLengthintegeroptionalMinimum length of the generated text
$maxLengthintegeroptionalMaximum length of the generated text
$suffixstringoptionalText to append to the generated value
$includeAlphabetbooleanoptionalIf true, the generated text includes alphabet characters
$includeNumericbooleanoptionalIf true, the generated text includes numeric characters
$includeSpecialbooleanoptionalIf true, the generated text includes special characters
$addTimestampbooleanoptionalIf true, appends a timestamp to the generated value

Returns

stringThe generated text value
Raw script
var $text = _generateText("txt_", 5, 10, "_end", true, true, false, false);

Sahi Pro Classic API _generateText

Modes BrowserWindowsJavaAndroidiOSSAP

Generates a random phone number based on the given formats.

Parameters

NameTypeDescription
$formatsarrayoptionalList of phone number formats to generate from, e.g. "+xx (xxx) xxx-xxxx", "xxx-xxx-xxxx"

Returns

stringThe generated phone number
Raw script
var $phone = _generatePhoneNumber(["xxx-xxx-xxxx"]);

Sahi Pro Classic API _generatePhoneNumber

Modes BrowserWindowsJavaAndroidiOSSAP

Generates a random number based on the given parameters.

Parameters

NameTypeDescription
$prefixstringoptionalText to prepend to the generated value
$minValueintegeroptionalMinimum value of the generated number
$maxValueintegeroptionalMaximum value of the generated number
$decimalsintegeroptionalNumber of decimal places in the generated number
$separatorstringoptionalThousands separator to use in the generated number
$decimalSeparatorstringoptionalDecimal separator to use in the generated number
$suffixstringoptionalText to append to the generated value

Returns

stringThe generated number
Raw script
var $number = _generateNumber("$", 1, 100, 2, ",", ".", "");

Sahi Pro Classic API _generateNumber

Modes BrowserWindowsJavaAndroidiOSSAP

Generates a random email address based on the given parameters.

Parameters

NameTypeDescription
$namesarrayoptionalList of names to use while generating the email address
$domainsarrayoptionalList of domains to use while generating the email address
$excludesarrayoptionalList of email addresses to exclude from generation
$addTimestampbooleanoptionalIf true, appends a timestamp to the generated email address

Returns

stringThe generated email address
Raw script
var $email = _generateEmail(["john"], ["example.com"], [], true);

Sahi Pro Classic API _generateEmail

Modes BrowserWindowsJavaAndroidiOSSAP

Generates a random date based on the given parameters.

Parameters

NameTypeDescription
$fromdateoptionalFrom date value for the generated date
$todateoptionalTo date value for the generated date
$formatstringoptionalFormat to use for the generated date

Returns

stringThe generated date
Raw script
var $date = _generateDate("2020-01-01", "2020-12-31", "yyyy/MM/dd");

Sahi Pro Classic API _generateDate

Modes BrowserWindowsJavaAndroidiOSSAP

Generates a random boolean value based on the given default value.

Parameters

NameTypeDescription
$defaultValuebooleanoptionalDefault value to use for the generated boolean

Returns

booleanThe generated boolean value
Raw script
var $flag = _generateBooleanValue(true);

Sahi Pro Classic API _generateBooleanValue