Java System.getProperty(“user.dir”)在调用stepDefinitions文件时为我提供eclipse pah
下面是我的简单步骤定义类Java System.getProperty(“user.dir”)在调用stepDefinitions文件时为我提供eclipse pah,java,eclipse,maven,cucumber,Java,Eclipse,Maven,Cucumber,下面是我的简单步骤定义类 package com.samp.stepDefinitions; import cucumber.api.PendingException; import cucumber.api.java.en.*; public class StepDefinitions { @Given("^when navigate to URL \"([^\"]*)\"$") public void when_navigate_to_URL(String arg1)
package com.samp.stepDefinitions;
import cucumber.api.PendingException;
import cucumber.api.java.en.*;
public class StepDefinitions
{
@Given("^when navigate to URL \"([^\"]*)\"$")
public void when_navigate_to_URL(String arg1) throws Throwable
{
System.out.println(System.getProperty("user.dir"));
}
}
以下是我的跑步课:
package com.samp.runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
format={"pretty"},
features={"src/test/java/features"}
)
public class CucumberRunner
{
}
在我的输出中,我看到了eclipse路径。如何查看maven项目路径我解决了这个问题,在项目级别配置了功能文件 例如:如果我的项目位于\ProjectName 如果是maven项目,我们有src\test\java等。。。不要将您的功能文件保存在此处的任何位置 将要素文件保持在项目级别,如 \项目名称\功能 如果我们保持这样,并配置标记,我们可以从任何运行器类运行这些特性