Add strings into a java list on cucumber feature
I would like to add the strings that I get in the steps from the cucumber feature to a list (without using .add
for each string).
eg, add the following strings in a list "string1","string2","string3"
Also, it would be nice if I can add on the cucumber feature to file more strings, and those will automatically be appended to the list.
I tried creating a table with Scenario Outline but no luck at the moment.
Please find below feature file and step definitions. It will take the list of string in the cucumber table and add it to list without using .add.
Feature: Get the list of strings from table
Scenario: Get the list of strings
Given Get the strings from following table and print
|Value1|
|Value2|
|Value3|
@Given("^Get the strings from following table and print$")
public void get_the_strings_from_following_table_and_print(List<String> lstStr) throws Throwable {
for(String str:lstStr)
System.out.println(str);
}
链接地址: http://www.djcxy.com/p/82620.html
上一篇: 提高执行时间以读取二进制文件
下一篇: 将字符串添加到黄瓜功能的Java列表中