cucumber jvm CucumberException:在 [] 处未找到任何功能 [英] cucumber jvm CucumberException: No features found at []

查看:20
本文介绍了cucumber jvm CucumberException:在 [] 处未找到任何功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的黄瓜 -jvm、Maven、junit 设置中,我的 testRunner 文件为

In my cucumber -jvm, Maven, junit Setup I have my testRunner file as

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 {
}

我在上述目录中有我的功能文件.

I have my feature file in the above mentioned directory.

如果我运行它,我会得到以下异常:

If I run it, I get the following exception:

cucumber.runtime.CucumberException: No features found at [C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources/cucumber]...

如果我删除 testrunner 中的功能"选项,它会尝试在与我的 testrunner.java 相同的目录中查找功能文件

If I remove the "features" option in the testrunner, it tries to look for feature files in the same directory as my testrunner.java

cucumber.runtime.CucumberException: No features found at [com/lebara/testrunner]

如果我把功能文件放在那里,它就可以工作.

And if I put the feature files there, it works.

我的问题是为什么没有从我以前的位置提取我的功能文件,我认为这是黄瓜的默认文件结构 - maven 设置.

My question is why is my feature file not being picked up from my previous location, which I thought to be the default file structure for cucumber - maven setup.

如何让它从那里取走?帮助表示赞赏.

How do I make it pick up from there? Help appreciated.

推荐答案

您的测试运行程序和功能文件到底在哪里?我有以下完美运行的设置:

Where exactly are your test runner and feature files? I've got the following setup which works perfectly:

src/test/
    java/
        com/mypackage/
            TestRunner.java
            StepDefinition.java
    resources
        com/mypackage/
            fancy.feature

Maven/Cuke 约定将从 tests/java 目录执行测试,并在 test/resources 目录中找到功能文件.我的测试运行器与您的基本相同,但选项较少:

The Maven/Cuke conventions will have the tests executed from the tests/java directory and the feature files found in the test/resources directory. My test runner is basically the same as yours but with less options:

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty"})
public class TestRunner { }

如果您还没有找到答案,希望这对您有所帮助.

Hope this helps if you hadn't already found an answer.

这篇关于cucumber jvm CucumberException:在 [] 处未找到任何功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆