黄瓜方案概述:传递空字符串“ "作为“示例”表中的值 [英] Cucumber Scenario Outline: Passing empty string " " as value in Examples table
问题描述
我有一个黄瓜方案概述,在该方案中,我想将一个空字符串()和换行符(\n \n \n)作为值传递给Examples表。我想编辑一个文本字段,并且要删除字符串,并希望传递空字符串或换行符。我要发送此值,然后按Enter。看起来像是.sendKeys(value + \n)。在示例表中,仅将值保留为空白并通过\n\n\n无效。文本字段中的值保持不变。
这是方案大纲的外观:
I have a cucumber scenario outline in which Examples table I would like to pass an empty string (" ") and line breaks (\n \n \n) as value. I want to edit an textfield and I am deleting the string and want to pass in the empty string or the line breaks. I want to send this value and press enter. This would look like this .sendKeys(value + "\n"). In the Example table just leaving the value blank and pass \n\n\n doesnt work. Value in textfield gets not changed.
This is how the Scenario outline looks like:
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 |
如何传递值?
当我刚刚传递值时如硬编码一样有效。文本字段至少已替换为值,但我希望将其用作占位符。
硬编码版本:
How do I pass the values?
When I am just passing the values as hardcoded it works. The textfield gets replaced at least with the values, but I would like to have it in as an placeholder .
Hard coded version:
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 |
有什么想法吗?谢谢
推荐答案
您只需要将< columnName>
功能定义中的。例如:
You only need to put the <columnName>
between "" in your feature definition. Example:
And I set name "<NewName>" for conversation
在您的步骤定义中,可以对步骤进行如下注释:
In your step definition, the step could be annotated like as follows:
@And("^And I set name \"([^\"]*)\" for conversation$")
public void And_I_set_name_for_conversation(String newName) throws Throwable {
...
}
希望有帮助
这篇关于黄瓜方案概述:传递空字符串“ "作为“示例”表中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!