所有功能文件均未执行

时间:2019-06-27 11:40:15

标签: java cucumber rest-assured cucumber-junit

黄瓜不能同时执行具有已创建阶梯定义的功能

我尝试使用标记,还给出了两个功能的完整路径,但仍然相同

package runners;

import com.cucumber.listener.ExtentProperties;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import managers.Common;
import managers.FileReader;
import org.apache.log4j.PropertyConfigurator;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import java.io.File;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = ".//src//test//java//FeatureList",glue = "stepDefinations",
        plugin = { "com.cucumber.listener.ExtentCucumberFormatter:",
                "junit:target/cucumber-results.xml"},
        tags={"@API"},
        monochrome = true
)
public class TestRunner {

    static String ReportName= Common.ReportName();

    @BeforeClass
    public static void setup() {

        ExtentProperties extentProperties = ExtentProperties.INSTANCE;
        extentProperties.setReportPath("target/cucumber-reports/"+ReportName+".html");
        PropertyConfigurator.configure(".//src//log4j.properties");
    }

    @AfterClass
    public static void writeExtentReport() {

        Reporter.loadXMLConfig(new File(FileReader.getInstance().getConfigReader().getReportConfigPath()));
        Reporter.setSystemInfo("User Name", System.getProperty("user.name"));
        Reporter.setSystemInfo("Time Zone", System.getProperty("user.timezone"));
        Reporter.setSystemInfo("Environment", FileReader.getInstance().getConfigReader().getEnvironment());
    }
}

不确定为什么它总是运行错误代码。功能却从不枚举。功能

enter image description here

功能:枚举代码     @API         场景:xxx枚举代码           给定Run get方法“ xxxxxxxxxxx” api,以获取所有类型的xxx xxx           那么响应应该是200           还有xxxxxxxxxxxxxx

功能:错误代码

@API     场景:xx错误代码       给定运行“ xxxx” api以获得响应       那么响应应该是200       并验证xx错误代码xx错误响应

1 个答案:

答案 0 :(得分:0)

“功能”正在寻找文件系统路径:

features =“ .// src // test // java // FeatureList”

尝试一下- 1个功能=“ src / test / java / FeatureList” 2个功能=“ FeatureList”