How to transfer an arbitrary object on the Fitnesse page?

I need to pass an object (my own business object) between two tables on the same page. The value is received from a getter call in one device, and then it should be used as a field in another device (both ColumnFixtures). Note that the passed object is neither primitive nor string, and conversion is not so simple. Is it possible? If so, how?

+3
source share
2 answers

I will check fitlibrary, thanks. In the meantime, I just found another and possibly better way:

use the API and save the value in the symbol map. You can simply set the key for the card through a regular field, and then restore it as follows: Fixture.setSymbol (...) and then Fixture.getSymbol (...). The above methods are also static, but this approach provides a little more flexibility, since the value of the variable is not complicated in the code, but rather indexed on the map :-)

0
source

Suppose you have two speaker mount tables, such as:

|TableOne            |
|inputOne|outputOne()|
|7       |14         |

and

|TableTwo            |
|inputTwo|outputTwo()|
|6       |20         |

then in the appropriate code you can save the object that you want to pass in a static variable (here I use int, but any type will work):

public class TableOne extends fit.ColumnFixture {
    public static int result;
    public int inputOne;
    public int outputOne() {
        result = inputOne * 2;
        return result;
    }
}

public class TableTwo extends fit.ColumnFixture {
    public int inputTwo;
    public int outputTwo() {
        return TableOne.result + inputTwo;
    }
}

ColumnFixture s, , ( , DoFixture), .

+1

Source: https://habr.com/ru/post/1711576/


All Articles