Skip to main content

Math Actions

DevAssure offers a comprehensive suite of built-in Math functions designed to streamline complex computations and empower users to perform calculations effortlessly. These functions are versatile, enabling seamless integration into test automation workflows.

Whether you need to compute specific data based on a formula, validate API responses, or ensure accuracy in UI data for FinTech or other precision-critical applications, DevAssure's Math functions provide the tools to make your testing robust and efficient.

Icon
ActionDescription
Math.Round (number) to (decimal places)Rounds the given number to the specified number of decimal places.
Math.Absolute value (number)Returns the absolute value of the given number (removes the sign).
Math.Text to numberConverts a text string containing numeric characters into a number.
Math.Sum (numbers)Calculates the sum (total) of a set of given numbers.
Math.Average (numbers))Calculates the average (mean) of a set of given numbers.
Math.Currency format (number) (currency format)Formats a given number as a currency string based on the specified format.

Math.Round (number) to (decimal places)

Rounds the given number to the specified number of decimal places.
  • Usage: Use this action to ensure numerical values are rounded to the desired precision for calculations or display purposes.

    roundedNumber = Math.Round number 3.1415 to decimal places 2

  • Arguments:

    • number: The numeric value to round.
    • decimal places: The number of decimal places to round the number to.

Math.Absolute value (number)

Returns the absolute value of the given number (removes the sign).
  • Usage: Useful for scenarios where only the magnitude of the number is required.

    absoluteValue = Math.Absolute value of (-9)

  • Arguments:

    • number: The numeric value to find the absolute value for.

Math.Text to number

Converts a text string containing numeric characters into a number.
  • Usage: Use this action to transform user inputs or text data into a number for further calculations.

    Math.Text to number 99
  • Arguments:

    • text: The text string to be converted.

Math.Sum (numbers)

Calculates the sum (total) of a set of given numbers.
  • Usage: Useful for aggregating values in a dataset. Click on the add numbers icon to include numbers as required.

    sum = Math.Sum 3 , 5 ,9

  • Arguments:

    • numbers: A set of numbers.

Math.Average (numbers)

Calculates the average (mean) of a set of given numbers.
  • Usage: Use this action to compute the central tendency of a dataset.

    average = Math.Average 3 , 5 ,9
  • Arguments:

    • numbers: A set of numbers separated by commas.

Math.Currency format (number) (currency format)

Formats a given number as a currency string based on the specified format.
  • Usage: Useful for displaying monetary values in a user-friendly format. If set, the result will have the correnponding currency symbol and formatting.

    currencyText = Math.Currency format roundedNumber currency code USD
  • Arguments:

    • number: The numeric value to format.
    • currency format: The desired currency format (e.g., USD, EUR, INR, JPY, GBP).