core-jgi/fitnesse/FitNesseRoot/FitNesse/UserGuide/ParameterizedIncludes/content.txt

17 lines
780 B
Plaintext

When using the CommonIncludes pattern you may come across duplicated content that varies with only one or two values. This can make using includes difficult but when combined with variables, includes become even more powerful. You can parameterize included pages by declaring variables in the test page and referencing them in the included page.
First we'll include a paraterized include page without defining any varaibles.
!include SampleParameterizedPage
Now we define the required variables.
!define NUMERATOR {100}
!define DENOMINATOR {10}
!define QUOTIENT {10}
!include SampleParameterizedPage
We can redefine the variables and use the parameterized include again.
!define NUMERATOR {555}
!define DENOMINATOR {5}
!define QUOTIENT {111}
!include SampleParameterizedPage