Referencing the value of a variable in Fitnesse by using another variable value

StackOverflow https://stackoverflow.com/questions/22161223

  •  19-10-2022
  •  | 
  •  

문제

Is it possible to re-use a variable in Fitnesse in referencing another variable:

for example

!define var1 {booking} !define bookingPeriod {June}

Is there a way to get the value of 'June' for booking period by concatenating var1 and 'period'

I tried the following but it didn't work

${${var1}Period}

Any help appreciated.

올바른 솔루션이 없습니다

다른 팁

There are actually two points you need to be aware of.

First, when composing variables you need to use different delimiters. FitNesse allows three different sets -- (), {}, [] -- just for that purpose.

Second, it is easier to compose in the definition itself, to wit:

!define FileName (${BaseName}.xls)
!define var1 {booking}
!define bookingPeriod $(${var1}June)

And then you can use ${bookingPeriod} in your code. I recently wrote a series of articles on practical FitNesse tips, published on Simple-Talk.com. Part 5 specifically discusses composing variables in this manner.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top