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.

This page describes each function available and how it can be used.

Use the following links to navigate to the relevant section:


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.

Date Functions

Date Add

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


  • {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

Date Format

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)


  • {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

Date Parse

This function converts a date from a String into a Date.



  • {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

List Functions


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.



  • {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:


This function tests whether a supplied list of values is Sorted in Ascending or Descending order.



  • {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

String Functions

String Trim

This function trims whitespace from a string.

FormatStringTrim(SourceString, TrimType)


  • {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     “

String Replace

Use this function when you need to modify parameterize a body of text.

FormatStringReplace(SourceString, FindString, ReplaceString)


  • {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

String Normalize

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)


  • {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)}

Other Functions

Unique Id

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.

FormatUniqueId(Length, Format)


  • {UniqueId(12,”NUMERIC”)} – This will generate a unique ID length 12 and a Number, e.g. 412373164167
  • {UniqueId(12,”ALPHA”)} – This will generate a unique ID length 12 and Alpha, e.g. GTWAWNZYWSIC
  • {UniqueId(8)} – This will generate a unique ID length 8 and defaults to Alphanumeric, e.g. I67OOO54
  • {UniqueId(36,”UUID”)} – This will generate a unique ID length 36 and will create a universally unique id


This function rounds a number to a defined specification.

FormatRound(number,decimal places,rounding mode)


  • {Round(3.2)} – Defaults to 0 decimal places, e.g. 3
  • {Round(3.4444,2)} – Round to 2 decimal places, e.g. 3.44
  • {Round(3.999,2,DOWN)} – Round Down, e.g. 3.99
  • {Round(3.999,2,UP)} – Round Up, e.g. 4.0


Leave A Comment