我遇到此错误:
作为步骤[输入用户名和密码 ]由2个参数定义 'stepdefenitions.loginstepdefenitions.enter_the_Username_String_username_and_Password_String_password(String,String) 在文件:/ C:/ Users / hai / eclipse-workspace / gherkins / bin /'中。然而 小黄瓜步骤有0个参数。
我的功能文件
Feature: Reset functionality on login page of Application
Scenario Outline: Verification of reset button with numbers of credential
Given Open the Chrome and launch the application
When Enter the Username <String,username> and Password <String,password>
Then Reset the credential
Examples:
|username |password |
|User1 |password1 |
|User2 |password2 |
答案 0 :(得分:1)
在特定的功能文件的步骤中尝试以下操作:
When Enter the Username "<username>" and Password "<password>"
在 Java 步骤中
@When("^Enter the Username \"([^\"]*)\" and Password \"([^\"]*)\"$")
public void enterTheUsernameAndPassword(String usnm, String pswd) {
System.out.println("The username is: " + usnm);
System.out.println("The password is: " + pswd);
}
查看文档以获取更多信息here。