针对空字符串结果的 Fitnesse 测试
我正在使用 Fitnesse SliM,我想检查固定装置的结果是否为空字符串。将 Fitnesse 中的结果字段留空只会导致测试被忽略,这显然不是我想要的。我可以通过扩展固定装置代码来解决这个问题,但我想知道这是否可以在 Fitnesse 本身内处理。
I'm using Fitnesse SliM and I want to check if the result of a fixture is the empty string. Leaving the result field in Fitnesse empty just results in an ignored test which is obviously not what I want. I could solve this by extending the fixture code, but I wonder if this can be handled within Fitnesse itself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看来 Slim 暗示将空字符串作为忽略,至少对于 QueryTable 装置来说: 表格中留空的单元格将从结果中填充并计为忽略。
尽管这不被认为是一个好的解决方案,但如果您确实需要,您可以使用正则表达式通过匹配来测试空字符串。
另一个选项是使用 null 固定装置 驱动程序,如 < a href="http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbolsCanBeBlankOrNull" rel="noreferrer">http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbolsCanBeBlankOrNull
It seems that Slim implies an empty string as an ignore, at least for the QueryTable fixture: A cell that is left blank in the table will be filled in from the result and counted as ignored.
Even though this is not considered a good solution, if you really have to you could use a regular expression to test on an empty string by matching on
Another option is using the null fixture driver, as seen in http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbolsCanBeBlankOrNull
传递“blank”一词会模拟一个空字符串。
就像:
|检查|返回的字符串是|空白|
passing the word 'blank' simulates a empty string.
like:
|Check|That the returned string is | blank |
在这种情况下 - 当您需要检查 SLIM 使用情况时,结果是否为空字符串,您可以使用标记变量。只需使用测试在页面上的某个位置定义它,例如:
!define Blank {}
然后在您想要的任何地方调用它:
|check|SomeFixtureName|${blank}|
In this case - when you need to check with SLIM usage, whether the result is an empty string, you can use markup variable. Just define it somewhere on your page with test, like:
!define blank {}
And then call it anywhere you want:
|check|SomeFixtureName|${blank}|