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 difficult to match the collections in the Output and Expected results with complete accuracy. An optional feature is now available to help 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, so that the validation linking entities in both panels are chosen based on the key values. For example an ID attribute that will not change across test runs could be used as a key attribute.
To set a key attribute, right-click on it in the Expected panel, and then select Key Attribute, as shown:
Key attributes are shown in italics in the current entity as well as in all other corresponding entities in the Expected panel, as shown:
To remove a key attribute, right-click on it in the Expected panel, and then select Key Attribute to clear the setting, as shown:
Setting multiple key attributes will attempt to match the full set.