在Cucumber(基于mvn的java项目)中,我们需要指定TestRunner中文件的位置(例如)功能文件的位置,如下所示
@CucumberOptions(features=("src\\test\\resources\\features"),
glue= {"com.testing.stepdefinitions"},
strict = true,
plugin= {"pretty","html:target/cucumber",
"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
)
public class MyRunner extends BaseClass{
}如何指定文件路径,使其在Windows和MAC中正常工作?
发布于 2019-10-02 20:11:04
请尝试以下选项,而不是src\\test\\resources\\features。这将适用于windows和Mac。
@CucumberOptions(features=("./src/test/resources/features"),发布于 2019-10-02 16:25:03
对于feature属性,将\\替换为/,例如:src/test/resources/features。
它适用于我使用Cucumber的应用程序(基于Windows和Unix的操作系统)。
注意,atrribute javadoc声明:
返回: 特性的uris
uri是由斜杠而不是反斜杠组成的。
另外,反斜杠是表示路径分隔符的一种特定于windows的方式。依赖“路径”概念(如File或Path )的标准JDK类将处理Linux上的斜杠,同样也会处理Windows上的斜杠。但事实并非如此。
https://stackoverflow.com/questions/58205375
复制相似问题