Fitnesse Slim: How to concatenate symbol

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

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:

  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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!