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

Note that, if you are using a negative number, the value should be enclosed in double quotes, e.g. {DateAdd(TODAY,”-1″)}.

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)

Note that Length and Format are both optional. If not supplied, the UniqueId value will be 12 alphanumeric characters.


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


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



  1. Kirithiga 24th October 2017 at 10:47 am - Reply

    {Unique(12,NUMERIC)} and {Unique(12,ALPHA)} – it should be without quotes

    • Hetty Weston 24th October 2017 at 11:36 am - Reply

      Hi Kirithiga, thanks for pointing that out! I have updated the UniqueId section to remove the quotes.

  2. Kirithiga 31st October 2017 at 10:51 am - Reply

    Thanks COOL 🙂

    Do we have any function to check the empty field? Like we use, isEmpty()

    I need to check the field that does not have any value.

    • Hetty Weston 2nd November 2017 at 4:36 pm - Reply

      Hi Kirithiga, you can use = “” or = null to check this in a condition. Alternatively in a read/assert (e.g. in Test Builder) you can just assert a blank value.

  3. Kirithiga 3rd November 2017 at 6:20 am - Reply

    I tried with both ” ” and ‘ ‘ and normalise ‘ ‘ with no spaces.. Finally worked for Equals false 🙂

    • Hetty Weston 24th November 2017 at 11:37 am - Reply

      Hi Kirithiga

      Thanks for the update! Glad to hear you got it working 🙂

  4. Vijaya Kolakalapudi 10th November 2017 at 7:50 pm - Reply

    Getting error message “Invalid expression– {DateAdd(TODAY, -5)}

    Thanks, Vijay

    • Hetty Weston 24th November 2017 at 12:06 pm - Reply

      Hi Vijay

      Negative numbers should be enclosed in double quotes for the expression to be accepted, so your example should be:
      {DateAdd(TODAY, “-5”)}

      It looks like this wasn’t included in our documentation, apologies! It has now been updated.


Leave A Comment