Cucumber script Schematic: passing an empty string "" as a value in the example table

I have a cucumber script diagram in which in the example table I would like to pass an empty string (") and line breaks (\ n \ n \ n) as a value. I want to change the text box and I delete the line and want to pass an empty line or line breaks. I want to send this value and press enter. It will look like this. sendKeys (value + "\ n"). In the Example table, just leave the value empty and pass \ n \ n \ n does not work. The value in text the field does not change.
Here's what the scenario diagram 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 to convey values?
When I just pass the values ​​as hardcoded, it works. The text field is replaced with at least values, but I would like to have it as a 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 | 

Any ideas? Thanks

+5
source share
1 answer

You only need to set <columnName> between "" in the definition of your function. Example:

 And I set name "<NewName>" for conversation 

In a step definition, a step can be annotated as follows:

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

Hope this helps

+7
source

Source: https://habr.com/ru/post/1201743/


All Articles