在 Fitnesse 中获取 !today 变量的子字符串
我正在为网络应用程序编写 Fitnesse 测试。要测试的项目之一是下拉框,其值由当前日期确定,格式为 DD/MM/YYYY。
我原以为在 Fitnesse 套件中使用 !today 变量可能是设置变量的有用方法,但我遇到了 Fitnesse 将日期表示为(例如)2011 年 3 月 11 日< /em>,我需要11/03/2011。我可以使用 -xml
修饰符获取数字格式的日期,但仍然留下一个相当大的字符串,例如 2011-03-11T05:51:22。
有没有办法获取它的子字符串,然后将它们通过管道传输到页面变量中,或者我在这里吠叫完全错误的树?
谢谢!
I'm writing a Fitnesse test for a web application. One of the items to test is a drop-down box, whose value is determined by the current date, in DD/MM/YYYY format.
I'd thought that using the !today variable in the Fitnesse suite might be a useful way of setting a variable, but I've run into the problem that Fitnesse expresses the date as (for example) 11 Mar, 2011, where I need 11/03/2011. I can get the date in numberic format using the -xml
modifier, but I'm still left with a pretty huge string like 2011-03-11T05:51:22.
Is there a way of getting substrings of this, and then piping those into page variables, or am I barking up entirely the wrong tree here?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(4)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
!today (MM/dd/yyyy)
生成09/17/2012
。您可以使用任何您喜欢的格式代码。它使用 SimpleDateFormat 类。!today (MM/dd/yyyy)
produces09/17/2012
. You can use any format codes you like. It uses the SimpleDateFormat class.