我在運行這個黃瓜項目下面有問題。這顯示在7號線,8,20和32在日食中用bdd運行黃瓜
package stepDefinition;
import cucumber.api.java.en.Given;
public class aptitudeTest {
@Given ("I have successfully ([^\"]*)")
public void I have (String str)
{
if (str.equals("registered"))
{
System.out.println("registered Automation");
}
{
System.out.println("unregistered Automation");
}
}
@When ("I enter my valid ([^\"]*)")
public void I enter (String str)
{
if (str.equals("credentials"))
{
System.out.println("credentials Automation");
}
{
System.out.println("details Automation");
}
}
@Then ("I should see the welcome ([^\"]*) him")
public void I should (String str)
{
if (str.equals("welcome"))
{
System.out.println("welcome to your account");
}
{
System.out.println("please enter the correct credential");
}
}
}
下面的錯誤是Feature文件
Scenario:I should see a message when i successfully logged in
Given I have successfully registered
When I enter my valid credentials
Then I should see the welcome message
我的意思是沒有不敬,但你最好的一步是採取一個介紹性的java類。 –
你應該看看你是如何命名的方法?名稱不能有空格。 https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html#naming – Grasshopper