在我的 cucumber -jvm、Maven、junit 设置中,我的 testRunner 文件为
package com.lebara.testrunner;
import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(
glue = {"com.lebara.stepdefs","com.lebara.framework.main", "com.lebara.testrunner"},
features = "C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources",
format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target/cucumber-report.json"},
tags = {"@UserJourney"}
)
public class RunCukesTest {
}
我的功能文件位于上述目录中。
如果我运行它,我会得到以下异常:
cucumber.runtime.CucumberException: No features found at [C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources/cucumber]...
如果我删除 testrunner 中的“features”选项,它会尝试在与 testrunner.java 相同的目录中查找功能文件
cucumber.runtime.CucumberException: No features found at [com/lebara/testrunner]
如果我把功能文件放在那里,它就可以工作。
我的问题是为什么我的功能文件没有从我之前的位置获取,我认为这是 Cucumber - maven 设置的默认文件结构。
我如何让它从那里接收?帮助表示赞赏。
您的测试运行程序和功能文件到底在哪里?我有以下完美运行的设置:
src/test/
java/
com/mypackage/
TestRunner.java
StepDefinition.java
resources
com/mypackage/
fancy.feature
Maven/Cuke 约定将从 test/java 目录执行测试,并在 test/resources 目录中找到功能文件。我的测试运行程序与您的基本相同,但选项较少:
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty"})
public class TestRunner { }
如果您还没有找到答案,希望这对您有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)