0
Scenario: Login Page with Valid credentials
Given user is on Application landing page
Then we verify following user exists
| name | email | phone |
| Shankar | [email protected] | 999 |
| Ram | [email protected] | 888 |
| Sham | [email protected] | 666 |
我之情况的文件在我的步骤定义,我想用for
和foreach
循环迭代。我试过用while
循环。它工作正常。任何人都可以告诉我如何迭代使用for and foreach loop
?
@Then("^we verify following user exists$")
public void we_verify_following_user_exists(DataTable datatable)
throws Throwable {
List<List<String>> data = datatable.raw();
Iterator<List<String>> it = data.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
而且我期待的输出像下面
name,email,phone
Shankar,[email protected],999
Ram,[email protected],888
Sham,[email protected],666
它增加了电话后列逗号,这是不是我的预期outpput – Aishu
如果这是一个问题请参阅https://stackoverflow.com/questions/285523/last-iteration-of-enhanced-for-loop-in-java – user7294900
更新解决方案。接受我的解决方案? – user7294900