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