HsacExamples.FitTests.ArraysAndSymbolsComparison


Symbol and array comparison

To use the symbol and array behavior, one must start by adding a $ to the end of the columnname.

Compare result with symbol

This functionality was added when we wanted to compare a returning value with a value that was earlier returned in the same testpage. How to use this functionality is demonstrated with the use of the CompareValues fixture. However this will work for all fixtures extending the nl.hsac.fitnesse.fixture.fit.MapColumnFixture.

Demonstration of comparing with symbol:


First store value1 and value2 in symbols so we can compare with them later.
CompareValues
value1 value2 =value1? =value2?
1 2 symbolValue1 = 1 symbolValue2 = 2

Now compare new value1 and value2 with the values stored in symbolValue1 and symbolValue2.

CompareValues
value1 value2 value1?$ value2?$
1 2 1 (symbolValue1) 2 (symbolValue2)
Tip: to see how the output is in case of a failure, change value1 and/or value2.

Compare result with an array

Functionality is added to compare the returning value of a column fixture with an array of values. The array of values can consist out of literal values, symbols or a combination of the two. If the array contains symbols, the symbols need to be prefixed with a $. While the symbol comparison (discussed above) works for all fixtures extending from the nl.hsac.fitnesse.fixture.fit.MapColumnFixture, for comparing with array one need to implement a method that returns the array of values as a string, separated by a delimiter. For an example, see the asDelimiterSepList method of the CompareValuesFixture class.

Demonstration of comparing with an array:


Compare value1 and value2 with values and symbols in an array.
CompareValues
value1 value2 asDelimiterSepList?$
1 2 1,2 (Array[1,2])
1 2 1,2 (Array[$symbolValue1,$symbolValue2])
1 2 1,2 (Array[$symbolValue1,2])
Tip: to see how the output is in case of a failure, change value1 and/or value2.

The default array separator is a comma. If you need another separator, ie // then you can specify this by using the ARRAY_SEPARATOR parameter.
CompareValues ARRAY_SEPARATOR=//
value1 value2 asDelimiterSepList?$
1 2 1//2 (Array[$symbolValue1//$symbolValue2])

Compare result with string containing a symbol

This was added to be able to compare the returning value of a column fixture with a string that contains a symbol.
The symbol in the string must be place in $[..].

Demonstration of comparing with text that contains one symbol:

CompareValues
value1 value2 =value2?$ value1?$
randomtext2 2 storedValue2 = 2 randomtext2 (randomtext$[storedValue2])
randomtext4moreText 4 storedValue4 = 4 randomtext4moreText (randomtext$[storedValue4]moreText)
randomtext2moreText4 = null randomtext2moreText4 (randomtext$[storedValue2]moreText$[storedValue4])