這是我的測試。我將src中的定義/特徵文件作爲包裝。此外,我下載了黃瓜插件,但我無法看到顯示在我的功能中的顏色。如何引用特徵和步驟定義@cucumberoptions。
package stepDefinition;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class aptitudeTest {
@Given ("^I have successfully ([^\"]*)$")
public void I_have_(String str)
{
if (str.equals("registered"))
{
System.out.println("registered Automation");
}
if (str.equals("unregistered"))
{
System.out.println("unregistered");
}
}
@When ("^I enter my valid ([^\"]*)$")
public void I_enter_(String str)
{
if (str.equals("credentials"))
{
System.out.println("credentials Automation");
}
if (str.equals("details"))
{
System.out.println("details");
}
}
@Then ("^I should see the welcome([^\"]*)him $")
public void I_should_(String str)
{
if (str.equals("message"))
{
System.out.println("message Automation");
}
if (str.equals("information"))
{
System.out.println("infomation");
}
}
}
這是我的特點
功能:登錄賬戶
@tester 場景:我看到消息時,我在
成功登錄鑑於我已經成功註冊 當我輸入了我的有效憑證 然後我應該看到歡迎訊息
鑑於我已成功取消註冊 當我輸入我的有效詳細信息 然後我應該看到歡迎消息
添加問題,什麼是項目結構?對於需要添加功能文件的目錄路徑的功能,如src \ test .... \ feature \。對於膠水添加包類路徑cucumber.test.steps – Grasshopper