Fitnesse Slim: How to concatenate symbol

2019-07-05 05:06发布

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条回答
Lonely孤独者°
2楼-- · 2019-07-05 05:21

I am stuck with the same problem currently. The only way I found was to:

  1. create a StringSupport class with a String concatenate(String s1, String s2) method
  2. import the package of that class in your FitNesse test
  3. put StringSupport in the available libraries in your FitNesse test with the Library table
  4. 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.

查看更多
登录 后发表回答