What functions can be used in a Quick Test script?

Function Name

Returns

Syntax

Example

Date Functions

Today

Returns the current date

Today()

Today() + 1

Now

Return the current date and time

Now()

Now()

Last day of the month

Returns the last day of the month of the given date

Last_day_of_month(Date*)

 

Last_day_of_month("13/1/2018") = 31/1/2018

Day_of

Returns the day of the given date

Day_of(Date*)

 

Day_of("13/1/2018") = 13

Month_of

Returns the month of the given date

Month_of(Date*)

Month_of("13/1/2018") = 1

Year_of

Returns the year of the given date.

Year_of(Date*)

Year_of("13/1/2018") = 2018

Day_of_week

Returns the day of week of the given date.

Day_of_week(Date*)

Day_of_week("13/1/2018") = 7

Date

Returns a date which is constructed from the given day, month and year.

Date(arg1,arg2,arg3)

Date(1,13,2018) = 1/13/2018

(When date format is MM/dd/yyyy)

* The date format should match the machine's Regional Setting date format.

 

 

 

Math Functions

Min

Min function returns the smallest value in 2 given values.

Min(num1, num2)

Min(10,2) = 2

Arguments can either be numbers or expressions that return a number.

Entering more or less than 2 arguments will cause an error.

 

Max

Max function returns the largest value in 2 given values.

Max(num1, num2)

Max(10,2) = 10

Arguments can either be numbers or expressions that return a number.

Entering more or less than 2 arguments will cause an error.

 

Random

Returns a random number within a specified range.

Random(min_value,max_value)

Example: Random(2,10) = 7

 

Text Functions

Left

Left returns the first character or characters in a text string, based on the number of characters you specify.

Left(text, [num_chars])

 

Left('Sale Price', 4) = 'Sale'

Right

Right returns the last character or characters in a text string, based on the number of characters you specify.

Right(text,[num_chars])

Right('Sale Price', 5) = 'Price'

Mid

Mid returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.

Mid(text, start_num, num_chars)

Mid('Fluid Flow',0,5) = 'Fluid'

If start_num is greater than the length of text, Mid returns '' (empty text).

If start_num is less than the length of text, but start_num plus num_chars exceeds the length of text, Mid returns the characters up to the end of text.

If start_num is less than 0, Mid returns the #VALUE! error value.

If num_chars is negative, Mid returns the #VALUE! error value.

 

Concatenate

Concatenate function joins two text strings into one string.

 

Concatenate(text1, text2)

Concatenate('Sale', ' Price') = 'Sale Price'

Find

Find function returns the position of a specified character or sub-string within a supplied text string.

 

Find( find_text, within_text )

Find( 'T', 'Original Text' ) = 10

Contains

Determines whether the value parameter occurs within this string, or if value is the empty string, and returns TRUE/FALSE

Contains(text, value) Contains('Original Text', 'nal') = True
Starts_with

Determines whether the beginning of the text matches value parameter and returns TRUE/FALSE

Starts_with(text, value) Starts_with('Original Text', 'Org') = True
Ends_with Determines whether the end of the text matches value parameter and returns TRUE/FALSE Ends_with(text, value) Ends_with('Original Text', 'xt') = True