问题
How would one concatenate a symbol with text on either side? For example:
- Prefix:
"GAR_"
- Variable:
$todayDate
- Suffix:
"_1"
GAR_$todayDate_1
Which would evaluate to:
GAR_07202012_1
When running the test in fitnesse, it seems as though the concatenation is working (GAR_$todayDate->[07202012]_1
). However, I am passing this value as a parameter to visual studio and I instead end up with the following text: GAR_$todayDate_1
.
When I remove the suffix or put a space between $todayDate
and "_1"
, everything works as expected.
Any help would be appreciated.
Things I have tried:
GAR_!-$todayDate-!_1
GAR_$todayDate!-_1-!
GAR_$todayDate${SUFFIX}
- static variable defined
Thanks, Mike
回答1:
I am stuck with the same problem currently. The only way I found was to:
- create a
StringSupport
class with aString concatenate(String s1, String s2)
method import
the package of that class in your FitNesse test- put
StringSupport
in the available libraries in your FitNesse test with theLibrary
table - in your
Script
, you can now do:|$result=|concatenate;|$s1|$s2|
To fit your exact use case, you just have to do the same concatenate() with 3 strings instead of just one.
来源:https://stackoverflow.com/questions/11586904/fitnesse-slim-how-to-concatenate-symbol