Data page unit test case assertions
Data page unit test cases help to validate that application data is loaded correctly. You configure assertions that define the expected output of the test. When the test runs, the expected result is compared with the actual results on the data page.
Assertions are applied in the order you that you define them. All assertions, except for run-time assertions, must pass for the test to be successful.
In addition to property and expected run-time assertions, you can create ordered list, unordered list, and result count assertions.
Expected run-time assertions
After you create a data page unit test case, the system generates the expected run-time assertion. The default value of the assertion is the time taken by the data page to fetch results when the test was first run. The system compares this time with the run time of any future tests. You can change this value or create additional assertions.
An actual run time that is significantly longer than the expected run time can indicate an issue, such as a connectivity issue between the application and database from which you are obtaining initial results.
Expected run-time assertion
You can configure property assertions to compare the expected value of one or more properties with the actual values on the data page.
In the following example, you can verify that the .pxMaxRecords property, which appears only once on the data page, is equal to 500.
Ordered list assertions
You can create ordered list assertions for a page list on the data page to apply assertions to all results returned by the data page so that you do not have to manually create assertions for each result in the list.
The following example shows the results that are obtained when the assertion runs are compared with the .pxResults property. This property contains the list of results that are obtained by running the data page. In addition, the assertion applies only to the data page entries that are specified for the filter value (when the Department is Engineering).
Ordered list assertion
Unordered list assertions
You can create unordered list assertions for a page list on the data page. These assertions determine whether the expected result is anywhere in the list of results returned by the data page.
In the following example, you can verify that the data page results contain an entry where Experience Required is equal to the value of 6, regardless of where the Experienced Required property appears in the data page.
Unordered list assertion
Result count assertions
You can configure assertions to compare the number of items that are returned in a page list, value list, or value group on the data page with the output that you expect to see on the clipboard.
In the following example, the result count assertion verifies that the number of returned results is greater than 7.
Result count assertion