【发布时间】:2014-10-28 02:30:19
【问题描述】:
我有一个黄瓜场景大纲,我想在示例表中传递一个空字符串 (" ") 和换行符 (\n \n \n) 作为值。我想编辑一个文本字段,我正在删除字符串并想传入空字符串或换行符。我想发送这个值并按回车。这看起来像这样 .sendKeys(value + "\n")。在示例表中,仅将值留空并通过 \n\n\n 不起作用。文本字段中的值不会改变。
场景大纲如下所示:
Scenario Outline: Do not accept erroneous input as group conversation name (only spaces and break lines)
Given I Sign in using login <Login> and password <Password>
And I see Contact list with name <Name>
And I create group chat with <Contact1> and <Contact2>
When I open conversation with <Contact1>, <Contact2>
And I open Conversation info
And I set name <NewName> for conversation
Then I do not see conversation <NewName> in contact list
And I see Contact list with name <Contact1>, <Contact2>
Examples:
| Login | Password | Name | Contact1 | Contact2 | NewName |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 | |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 | \n\n\n\n |
如何传递值?
当我只是将值作为硬编码传递时,它可以工作。文本字段至少被替换为值,但我想将它作为占位符。
硬编码版本:
Scenario Outline: Do not accept erroneous input as group conversation name (only spaces)
Given I Sign in using login <Login> and password <Password>
And I see Contact list with name <Name>
And I create group chat with <Contact1> and <Contact2>
When I open conversation with <Contact1>, <Contact2>
And I open Conversation info
And I set name for conversation
Then I do not see conversation in contact list
And I see Contact list with name <Contact1>, <Contact2>
Examples:
| Login | Password | Name | Contact1 | Contact2 |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 |
Scenario Outline: Do not accept erroneous input as group conversation name (line breaks)
Given I Sign in using login <Login> and password <Password>
And I see Contact list with name <Name>
And I create group chat with <Contact1> and <Contact2>
When I open conversation with <Contact1>, <Contact2>
And I open Conversation info
And I set name \n\n\n\n\n for conversation
Then I do not see conversation \n\n\n\n\n in contact list
And I see Contact list with name <Contact1>, <Contact2>
Examples:
| Login | Password | Name | Contact1 | Contact2 |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 |
有什么想法吗?谢谢
【问题讨论】:
-
嗨@julesmummdry!你最终使用了我的解决方案吗?如果是这样,如果有帮助,也许您可以将答案标记为已接受
标签: cucumber string cucumber-jvm