Use of variables, arrays and complex types in Generic Fixture

Please visit Introducing FitNesse’s Generic Fixture for introductory details about Generic Fixture.Here we shall see how we can use variables in Generic Fixture.You can use a variable myVar in test tables like this to store return value of method1:
| myVar=method1 | arg1 | arg2 | | returnValue |
….
….
or You can use a variable “params” in a test table like this to store the SUT (System Under Test, which is a HashMap here) itself:
!| Generic Fixture | params=java.util.HashMap |
| put | curr_id | 128 |
| size | | 1 |
| toString | |

and later to use this variable myVar in an argument list use this syntax:
| method2 | myVar= | arg2 | | returnValue |
….
or to use this variable myVar in return value use this syntax:
| method3 | arg1 | | myVar= |
….
or You can even use this variable myVar to instantiate a new class, use this syntax:
!| Generic Fixture | myClass | myVar= |
….
Continue reading
Advertisements