We're here to help
Using functions
It is often useful when building Test Cases to enter values which are tailored to their context. In Provar this is done using functions. You can access the majority of functions using Content Assist, which we recommend using to help prevent syntax issues. You can access Content Assist by choose CTRL + spacebar (or CMD + spacebar on a Mac), or right-click and choose Content Assist. Provar will provide a pop-up with a list of possible options to choose from.
This page describes each function available and how it can be used.
Usage
Functions generally have brackets () after the function name. String parameters to be passed into functions should be within double quotes (“e.g.”).
Function definitions are also available in the Assistant when a specific function is highlighted in the variable picker.
DateAdd
This function adds a defined number of days to a given date to create a later date value. This is useful for avoiding hardcoding a date in a Test Step, e.g. populating an Opportunity Close Date to be 5 days after today’s date.
Format: DateAdd(date,amount,unit)
There are two internal functions which are useful when managing dates:
TODAY will create a date and use the system date
NOW will create a date timestamp and use the system date
Examples:
{TODAY}– This will default to system date, e.g. 2015-01-16
{NOW}– This will default to system date and time, e.g. 2015-01-16 10:13:43.0
{DateAdd(TODAY,1)}– This will default to tomorrow, e.g. 2015-01-17
{DateAdd(TODAY,“-1”)}– This will default to yesterday, e.g. 2015-01-15
{DateAdd(TODAY,1,MONTH)}– This will add one month to current date, e.g. 2015-02-16
{DateAdd(NOW,“-2”,HOUR)}– This will remove two hours from current datetime, e.g. 2015-01-16 08:15:27.0
Note that, if you are using a negative number, the value should be enclosed in double quotes, e.g. {DateAdd(TODAY,“-1”)}.
DateFormat
This function converts a date into a specific format. Refer to SimpleDateFormat for more information on available date formats.
Format: DateFormat(date,output format,timezone)
Examples:
{DateFormat()}– Defaults to system date in the format yyyy-MM-dd, e.g. 2015-01-16
{DateFormat(TODAY,“MM-dd-YYYY”)}– Modify date format to be month-first, e.g. 01-16-2015
{DateFormat(DateAdd(TODAY,5),“MM-dd-YYYY”)}– Use with other functions, e.g. 01-21-2015
{DateFormat(NOW,“MM-dd-YYYY hh a zzzz”,“GMT”)}– Including a timezone, e.g. 01-16-2015 10 AM Greenwich Mean Time
DateParse
This function converts a string to a date.
Format: DateParse(DateString,InputFormat,OutputFormat)
Examples:
{DateParse(“2015-03-15”, “yyyy-MM-dd”)}– Will return this string as a date, e.g. 2015-03-15
{DateParse(“2015-03-15”, “yyyy-MM-dd”,“MM-dd-yyyy”)}– Will return this string as a date and convert the date into a new format, e.g. 03-15-2015
Count
This function counts the number of items in a list. This is useful in conjunction with checking the number of values returned when executing a SOQL or SQL Test Step.
Format: Count(List)
Examples:
{Count(AccountRows)}– If there are two accounts returned, this function will return 2
{Count(AccountRows) > 0}– This can be used in expressions to return true or false (see below)

Using this {Count(AccountRows) > 0}expression, Count can be used to verify that records have been successfully extracted during an SOQL Query.
First the Account object is queried and results placed into AccountRows:
Then the number of results are counted and, if more than one Account result exists, AccountNames is set to true:
Then the result is asserted to check for the true value.
Alternatively, a UI Assert could be used to retrieve values:
IsSorted
This function tests whether a supplied list of values is Sorted in Ascending or Descending order.
Format: IsSorted(Values,‘Name/ColNumber,Order,Type,Format’)
Examples:
{IsSorted(Col.columns.dueDateTimeColumnMain.columnValues, “1 ASC DATE dd/MM/yyyy hh:mm aaa”)}– Results true if supplied list of values with mentioned dateformat is in Ascending order
{IsSorted(Col.columns.caseNumber.columnValues, “1 DESC”)}– Results true if supplied list of values with default type and format is in Descending order
StringTrim
This function trims whitespace from a string.
Format: StringTrim(SourceString, TrimType)
Examples:
{StringTrim(” String “)}– This will default to trimming both ends of the string, e.g. “String.
{StringTrim(” String “, LEADING)}– This will remove white space just at the beginning of the string, e.g. “String”
StringReplace
Use this function when you need to modify parameterize a body of text.
Format: StringReplace(SourceString, FindString, ReplaceString)
Examples:
{StringReplace(“Dear Customer”, “Customer”, CustomerName)}– Where CustomerName is a Variable, e.g. “Dear David”
{StringReplace(Template, “TODAYSDATE”, TODAY)}– Where Template is a file from the file system with the text “Today is TODAYSDATE”, e.g. Today is 2015-01-16
StringNormalize
This function normalizes a supplied string in various possible ways, e.g. removing any leading or trailing whitespace or removing consecutive whitespace characters.
Format: StringNormalize(SourceString,trimlines)
Examples:
{StringNormalize(“Extra space Extra space”)}– Remove consecutive whitespace, e.g. “Extra space Extra space”
{StringNormalize(“Carriage return\r\nCarriage Return”)}– Replace carriage return and line feed with line feed, e.g. “Carriage return\nCarriage Return”
{StringNormalize(” leading and end space “)}– Remove leading and trailing whitespace, e.g. “leading and end space”
{StringNormalize(” leading and end space “}– Option to remove leading and trailing spaces for each line, e.g. “leading and end space\ntest lines” test lines “,true)}
NumberFormat
This function formats a number in a defined pattern. The NumberFormat class is used to format numbers according to a specific Locale. Different countries have different standards for how they format numbers.
Format: NumberFormat(numberToformat, outputFormat, language, countryCode, groupingSeparator, decimalSeparator)
Note that language, countryCode, groupingSeparator and decimalSeparator are optional.
Examples
Case 1
If you are giving the locale, then the number format will work only for the symbols of that particular locale.
Example: {NumberFormat(12333456.7847, “##,#####.####”, “en”, “US”)}
Output – 123,33456.7847
Case 2
If you are not providing the locale, default locale will be en-IN. Number will be formatted as per the locale’s symbols.
Example: {NumberFormat(“324567.89”, “PLN ###,###.##”)}
Output – PLN 324,567.89
Case 3
If you want to have space as a separator in your output format, you will have to explicitly give it as a parameter.
Example: {NumberFormat(“345126.7847”, “## ###,####”, “bg”, “BG”, ” “)}
Output – 345 126,7847
Case 4
If you want to specify your own symbols in outputFormat, don’t provide the locale. Instead, you should mention the separator symbols as parameters to the method.
Example 1: {NumberFormat(“324567.89”, “PLN ### ###,##”, null, null, ” “, “,”)}
Output – PLN324 567,89

Example 2: {NumberFormat(“12333456.7847”, “##,###/####”, “fa”, “IR”, “,”, “/”)}
Output – 12,333,456/7847
In addition, if you need to provide a decimal in the number to be formatted, if there is no decimal in numberToformat then the output will format only the integer part.
Example 3: {NumberFormat(12337847, “##,#####.####”, “en”, “US”)}
Output – 123,37847
UniqueId
This function generates a unique value. This is typically used in a Set Values Test Step to create a variable, which can then be referred to to generate and identify test data during a test.
Format: UniqueId(Length, Format)
Note that Length and Format are both optional. If not supplied, the UniqueId value will be 12 alphanumeric characters.
Examples:
{UniqueId(8)}– This will generate a unique ID, length 8, of alphanumeric characters, e.g. I67OOO54
{UniqueId(12,NUMERIC)}– This will generate a unique ID, length 12, using numbers only, e.g. 412373164167
{UniqueId(12,ALPHA)}– This will generate a unique ID, length 12, using letters only, e.g. GTWAWNZYWSIC
{UniqueId(36,UUID)}– This will generate a univerally unique ID, length 36, e.g. 8398e3c6-94ef-4e90-a809-03191424fda0
Round
This function rounds a number to a defined specification.
Format: Round(number,decimal places,rounding mode)
Examples:
{UniqueId(36,UUID)}– Defaults to 0 decimal places, e.g. 3
{Round(3.999,2,DOWN)}– Round Down, e.g. 3.99
{Round(3.999,2,UP)}– Round Up, e.g. 4.0