Reputation: 1800
Using Maven whenever I am trying run my feature file in eclipse I am getting below error:
Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory: G:\Codebase\MavenCucumber--plugin at cucumber.runtime.io.FileResourceIterator$FileIterator.(FileResourceIterator.java:54) at cucumber.runtime.io.FileResourceIterator.(FileResourceIterator.java:20) at cucumber.runtime.io.FileResourceIterable.iterator(FileResourceIterable.java:19) at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:38) at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:117) at cucumber.runtime.Runtime.run(Runtime.java:92) at cucumber.api.cli.Main.run(Main.java:20) at cucumber.api.cli.Main.main(Main.java:12)
The above image is the structure of my project and feature file contains below code-
@tag
Feature: Proof of Concept
@tag1
Scenario: This is my first test Scenerio
Given This is my first step
When This is my second step
Then This is my third step
Upvotes: 3
Views: 35625
Reputation: 497
Just add feature & stepDefination package like below into your TestRunner Java class
@CucumberOptions(features = "src/test/java/feature",
glue = "src/test/java/stepDefination", monochrome = true)
public class TestNGRunner extends AbstractTestNGCucumberTests{
}
Upvotes: 0
Reputation: 1
The issue was resolved by creating a separate folder i.e. 'Feature' under a project,instead of keeping the feature file in sub folder of a project.
Upvotes: -1
Reputation: 11
Actually, The issue happened with me because the feature file name was written in upper case. When I changed it to a lower case the issue was resolved.
Upvotes: 1
Reputation: 5
below Cucumber Options format worked for me
src\\main\\java\\com.qa.features
com.qa.stepDefinition
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src\\main\\java\\com\\qa\\features"
,glue={"com/qa/stepDefinition"}
,format={"pretty","html:test-output"}
}
Upvotes: 0
Reputation: 101
This error clearly says that "Not a file or directory" which means the path is not correct. There can be multiple cause for this.
One is upgrading the Cucumple libraries to latest version, which worked in your case.
Second is the placement of the feature files. I assume that the feature files can be at the two places only:
In the first case you should specify your CucumberOptions as below:
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/somefolder/Feature"
In the second case:
@RunWith(Cucumber.class)
@CucumberOptions(
features = "Feature")
Look at the example of second case here http://toolsqa.com/cucumber/first-cucumber-selenium-java-test/
Upvotes: 3
Reputation: 1800
I was using 1.1.2 version jar for cucumber-java,cucumber-junit,cucumber-picocontainer. Because of that I got above mentioned error.
Now I am using 1.2.2 version jar and it is working absolutely fine with this version.
Upvotes: 6