Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cucumber jvm CucumberException: No features found at []

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]...

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.

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.

like image 955
TestAutomationEng Avatar asked Jan 21 '13 11:01

TestAutomationEng


1 Answers

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

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.

like image 166
Doughnuts Avatar answered Sep 23 '22 14:09

Doughnuts