我正在编写一个功能,我们想用颜色来表示正数或负数,其中负数为红色,正数为黑色。它基本上是这样的:
Given I bought 2 items
Then I have returned 1 item
Then on the return receipt I should see both items and their costs
And these lines should be black
Then below that I should see the item I return and it's cost as a negative number
And that line should be red
由于Behat / Mink还不能做到这一点,我该如何测试呢?它真的需要测试吗?我的想法是因为这是向开发人员描述网站应该如何工作的功能,如果我不把它放在这里,他们怎么知道返回的项目需要用红色显示?
想法?谢谢:))
答案 0 :(得分:1)
颜色是在场景中没有位置的实现细节。重要的是回执收据告诉你
所以我把这个场景写成
Given I purchased two items
And I returned one of the items
When I view the return reciept
Then I should see two items were purchased
And I should see that one item was returned
现在,当您的产品所有者决定将退回的商品视为红色并不足够时,并且需要将其放入包含“退回”的框中。作为标题,你不必重写你的场景