We're here to help

Count

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.

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

 

Practice


Want to learn more about using this function in Provar? 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 Provar.

Note: You will need to unzip/extract the compressed file before using it in Provar.