Use key attributes to improve difference detection in Ruletests
- Last Updated: June 9, 2021
- 2 minute read
- Corticon
- Version 7.2
- Documentation
The execution of Ruletests can, in some cases, erroneously detect differences between the Output and Expected results. This typically occurs in Rulesheets that add new entities to collections. The unsorted nature of collections makes it impossible to match the collections in the Output and Expected results with complete accuracy. An optional feature is available when you encounter problems with test failures due to the randomness of entity ordering. To avoid this problem, you can specify certain attributes as key attributes that will assist the comparison algorithm, that the validation linking entities in both panels are chosen based on the key values.
To set a key attribute, right-click the attribute in the Expected panel, and then choose Key Attribute, as shown:

Key attributes are shown in italic in the current entity as well as all other corresponding entities in the Expected panel, as shown:

To remove a key attribute, right-click on the attribute again in the Expected panel, and then choose Key Attribute to clear the setting.
Setting multiple key attributes attempts to match the full set.