【发布时间】:2015-03-03 18:13:30
【问题描述】:
我有这样一个步骤:
@When("I add an attribute named '(.+)' with unit '(.+)' to the item named '(.+)'")
public void addAttributeToAndItem(String attributeName, String unitName, String itemName){
.....
}
在我的黄瓜场景中,我想添加和属性没有单位,所以“单位名称”的值应该是空字符串。如何在我的场景步骤中指定这个空字符串。
我试过这个:
Scenario: add attribute to an item
When I add an attribute named 'Color' with unit ' ' to the item named ' Car'
但它不起作用。 ' ' 总是看起来是一个值(一个空格),而不是一个空字符串。请问有人可以帮我吗?
【问题讨论】:
-
' '是一个空格。将''用于空字符串或在测试步骤代码中使用其他被理解为空的内容 -
你要解决的实际问题是什么,如果
是颜色的单位,会发生什么糟糕的事情。