Search code examples
javafitnesse

Set any field once for all the tests in Fitnesse table


I want to set one field in the fitnesse table, only once for all the tests. For example I want to set Operator as + for all the tests in the table.

Below is the regular table.

!|CalculatorFixture                |
 |Value1|Operator|Value2|calculate?|
 |3.0   |+       |5.0   |8.0       |
 |2.0   |*       |3.5   |7.0       |

I want something like:

!| CalculatorFixture      |
 |Operator                |
 |+                       |
 |Value1|Value2|calculate?|
 |3.0   |5.0   |8.0       |
 |6.0   |3.0   |9.0       |
 |5.0   |2.0   |7.0       |

Any Idea how can I achieve this in the fixture or in the fitnesse table? FYI, I am using Slim: !define TEST_SYSTEM {slim}


Solution

  • You can set a Java static field in a previous table fixture and then access it in the CalculatorFixture.