Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

ElementComparators allow you to define your own way of verifying that values output from a pipeline and displayed in XNAT are correct. Out of the box, NRG_Selenium comes with support for the following comparators. The "CSV key" is the value that should be used in the spreadsheet to indicate what type of comparator to use:

ElementComparatorCSV keyExtra config required
EqualityElementComparator"Equals" OR "" OR emptyNone
PercentToleranceElementComparator (minimum)"minPercentTolerance"Minimum percent tolerance allowed (e.g. 1.5)
PercentToleranceElementComparator (maximum)"maxPercentTolerance"Maximum percent tolerance allowed (e.g. 2.3)

A quick about PercentToleranceElementComparator: the minimum version specifies that the percent error between the values must be greater than some specified value, while the maximum version specifies that the percent error bewteen the values must be less than some specified value. The maximum version is much more useful and logical, but it was easy to include the other version. If you wish to write your own comparator, simply extend ElementComparator and define a custom version of checkPointsMatch(...). For optimal results, don't throw an Exception when the check fails; instead, simply return any non-null String describing the error, and this will be collected for you and listed at the end with pipeline errors. If the comparator is satisfied correctly, simply return null.

  • No labels