如何在表格中传递空格?
Background:
Given the following books
|Author |(here several spaces)Title(here several spaces)|
答案 0 :(得分:11)
我会这样做:
Given the following books
| Author | Title |
| "J. K. Rowling" | "Harry P " |
| " Isaac Asimov " | "Robots and Empire" |
然后你的绑定可以剥离引号(如果存在),但保留空格。
我认为这比之后添加空格的想法更为可取,因为这不是人类可读的 - 引用会使人类(利益相关者/编码人员)可以阅读它们。
答案 1 :(得分:3)
您可以通过添加额外步骤来解决此问题。类似的东西:
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>
答案 2 :(得分:0)
我只是面临同样的情况,我的解决方案是这样,在步骤中添加空格如下:
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 |