Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java System.getProperty(“user.dir”)在调用stepDefinitions文件时为我提供eclipse pah_Java_Eclipse_Maven_Cucumber - Fatal编程技术网

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等。。。不要将您的功能文件保存在此处的任何位置

将要素文件保持在项目级别,如 \项目名称\功能

如果我们保持这样,并配置标记,我们可以从任何运行器类运行这些特性