如何在表格中传递空格?
Background:
Given the following books
|Author |(here several spaces)Title(here several spaces)|
如何在表格中传递空格?
Background:
Given the following books
|Author |(here several spaces)Title(here several spaces)|
我会这样做:
Given the following books
| Author | Title |
| "J. K. Rowling" | "Harry P " |
| " Isaac Asimov " | "Robots and Empire" |
然后可以进行绑定以去除引号(如果存在),但保留空格。
我认为这比在之后添加空格的想法更可取,因为这不是人类可读的 - 引用将使阅读它们的人(利益相关者/编码人员)可以看到空格。
您可以通过添加一个额外的步骤来解决它。就像是:
Given the following books
|Author | Title |
Add append <5> spaces to book title
编辑:
一个完整的功能可能类似于:
Scenario: Adding books with spaces in the title
Given the following book
| price | title |
And <5> spaces appended to a title
When book is saved
Then the title should be equals to <title without spaces>
我刚遇到同样的情况,我的解决方案是这样,在步骤中添加空格如下:
Scenario: Adding books with spaces in the title
Given the following book ' <title> '
When book is saved
Then the title should be equals to '<title>'
| price | title |
| 50.00 | Working hard |