针对空字符串结果的 Fitnesse 测试

发布于 2024-09-08 08:44:23 字数 133 浏览 1 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷途知返 2024-09-15 08:44:23

看来 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

灰色世界里的红玫瑰 2024-09-15 08:44:23

传递“blank”一词会模拟一个空字符串。

就像:

|检查|返回的字符串是|空白|

passing the word 'blank' simulates a empty string.

like:

|Check|That the returned string is | blank |

千纸鹤 2024-09-15 08:44:23

在这种情况下 - 当您需要检查 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}|

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文