Documentation

Looking for something in particular?

Count

This function counts the number of items in a list. This is useful for checking the number of values returned when executing a SOQL or SQL Test Step.

FormatCount(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 a SOQL Query.

First, the Account object is queried, and results are placed into AccountRows:

Then the number of results is counted and, if more than one Account result exists, AccountNames is set to true:

Then, the result is asserted to check for the actual value.

Practice


Want to learn more about using this function in Automation? You can use the following sample test case to get started. Simply right-click to download Count.testcase and then drag and drop the test case into the test folder within the Navigator panel of Automation.

Note: You must unzip/extract the compressed file before using it in Automation.

For more information, check out this course on University of Provar.


Feedback

Was this article helpful for you?
Documentation library

Trying to raise a case with our support team?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top