gpt4 book ai didi

cucumber 场景大纲 : Passing empty string "" as value in Examples table

转载 作者:行者123 更新时间:2023-12-02 21:22:05 31 4
gpt4 key购买 nike

我有一个 cucumber 场景大纲,其中示例表我想传递一个空字符串(“”)和换行符(\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 |

有什么想法吗?谢谢

最佳答案

您只需输入 <columnName>功能定义中的“”之间。示例:

And I set name "<NewName>" for conversation

在步骤定义中,可以按如下方式对步骤进行注释:

   @And("^And I set name \"([^\"]*)\" for conversation$")
public void And_I_set_name_for_conversation(String newName) throws Throwable {
...
}

希望对你有帮助

关于 cucumber 场景大纲 : Passing empty string "" as value in Examples table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25646865/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com