[英]Fitnesse test against empty string result
I'm using Fitnesse SliM and I want to check if the result of a fixture is the empty string. 我正在使用Fitnesse SliM,我想检查一个灯具的结果是否为空字符串。 Leaving the result field in Fitnesse empty just results in an ignored test which is obviously not what I want.
将结果字段留在Fitnesse中只会导致忽略测试,这显然不是我想要的。 I could solve this by extending the fixture code, but I wonder if this can be handled within Fitnesse itself.
我可以通过扩展夹具代码来解决这个问题,但我想知道这是否可以在Fitnesse本身内处理。
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 . 似乎Slim暗示一个空字符串作为忽略,至少对于QueryTable fixture: 在表中留空的单元格将从结果中填入并计为忽略 。
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 另一种选择是使用null fixture驱动程序,如http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbolsCanBeBlankOrNull中所示。
passing the word 'blank' simulates a empty string. 传递'blank'这个词会模拟一个空字符串。
like: 喜欢:
|Check|That the returned string is | |检查|返回的字符串是| blank |
空白|
In this case - when you need to check with SLIM usage, whether the result is an empty string, you can use markup variable. 在这种情况下 - 当您需要检查SLIM用法时,结果是否为空字符串,您可以使用标记变量。 Just define it somewhere on your page with test, like:
只需在测试页面的某个位置定义它,例如:
!define blank {} !define blank {}
And then call it anywhere you want: 然后在任何地方调用它:
|check|SomeFixtureName|${blank}| |检查| SomeFixtureName | $ {空白} |
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.