fitSharp
Symbol Values
The symbol save operator (>>) and the symbol recall operator (<<) can be used to collect a value at one place in a story test and then use it in other places.

The symbol save operator can be used in any expected value cell. Instead of comparing the actual value to an expected value, the actual value is saved with the symbol name.

when input is
story test fixture
checkplain test'sample class'
set field something
check field >>mysymbol
set field null
check field >>nullsymbol
sample class
set field something
check field >>mysymbol something
set field null
check field >>nullsymbol null
'sample class'
set field something
check field >>mysymbol
set field null
check field >>nullsymbol
then output is
sample class
set field something
check field >>mysymbol something
set field null
check field >>nullsymbol null

The symbol recall operator can be used in any input or expected value cell. The value used will be the last value saved with the symbol name.

when input is
story test fixture
checkplain test'sample class'
set field something
check field <<mysymbol
set field null
check field <<nullsymbol
set field <<mysymbol
check field something
set field <<nullsymbol
check field null
sample class
set field something
check field <<mysymbol something
set field null
check field <<nullsymbol null
set field <<mysymbol something
check field something
set field <<nullsymbol null
check field null
'sample class'
set field something
check field <<mysymbol
set field null
check field <<nullsymbol
set field <<mysymbol
check field something
set field <<nullsymbol
check field null
then output is
sample class
set field something
check field <<mysymbol something
set field null
check field <<nullsymbol null
set field <<mysymbol something
check field something
set field <<nullsymbol null
check field null

We can save any value in a symbol, e.g. a byte array.

when input is
story test fixture
checkplain test'sample class'
set bytes 0x010203
check bytes >>bytesymbol
check bytes <<bytesymbol
sample class
set bytes 0x010203
check bytes >>bytesymbol System.Byte[]
check bytes <<bytesymbol System.Byte[]
'sample class'
set bytes 0x010203
check bytes >>bytesymbol
check bytes <<bytesymbol
then output is
sample class
set bytes 0x010203
check bytes >>bytesymbol System.Byte[]
check bytes <<bytesymbol System.Byte[]

Symbol values can also be assigned with the Name Keyword and the Configure Fixture and used with the Use Fixture and With Keyword.

Symbols can be erased with the Clear Symbols Fixture.

We can also get and set symbol values in fixture code:
    if (Symbols.HasValue("stuff")) {
        var mySymbol = Symbols.GetValue("stuff);
    }

    Symbols.Save("another") = "one";
Notes:

This is a separate feature from the FitNesse wiki symbol feature.

Copyright © 2022 Syterra Software Inc. All rights reserved.