USA
800 691 9120
UK
01225 704844
We use cookies on our website to analyze website usage and to help secure the website against misuse. Advertising and functional cookies are not used in our site or our web application products.
By clicking “Accept Essential Cookies Only”, you consent to us placing these cookies.
Assert that the number of rows in a table matches an expected count
Counts rows in the specified table matching the optional WHERE clause, then compares the count against the expected value. Throws an exception if the comparison fails. The expected value can include a comparator prefix such as >=, <=, <>, >, or <. In the error message, use $filter, $table, $count, and $expectedcount as substitution tokens.
| Parameter | Description |
|---|---|
| cmd | table name to count rows in |
| Argument 0 | WHERE clause (without the WHERE keyword), or leave blank to count all rows |
| Argument 1 | expected count, optionally prefixed with a comparator (e.g. >=5, <>0) |
| Argument 2 | error message to raise if the assertion fails (supports $filter, $table, $count, $expectedcount tokens) |
Test.Count "table name to count rows in", "WHERE clause (without the WHERE keyword), or leave blank to count all rows", "expected count, optionally prefixed with a comparator (e.g. >=5, <>0)", "error message to raise if the assertion fails (supports $filter, $table, $count, $expectedcount tokens)"