0

I have windows 10 and using cucumber version 1.2.5

I have the following in the TestRunner

@CucumberOptions(
        plugin = {"pretty"},

        features = {"src/test/resources/features"})

However I am getting this error :

java.lang.IllegalArgumentException: Not a file or directory: C:\Users\myuserid\Int_workspace\myprojectname\src\test\resources\features

Please it is giving fullpath name (giving userName and workspace name and projectName)...Somehow I have setting and properties somewhere that is causing this issue. I have tried all recommendation on the internet but none is working...

2
  • "I have tried all recommendation on the internet but none is working" list some recommendations you have tried. – Alexey R. Apr 23 '18 at 12:42
  • Change the version. Moved it up and down to 1.2.0 and 1.2.2 1.2.3 Delete .M2 and regenerate the Maven..interesting is that eventhough the test runner is giving the classpath (src/test/resources/feature) I am getting the fullpath in the error starting with C disk.. – anthony S. Apr 23 '18 at 13:11
3
  1. Try adding only Feature folder name in "features" instead of the full folder path.

EX:

@RunWith(Cucumber.class)
@CucumberOptions(
        format = {"pretty", "html:target/Destination"},
        features = "Feature", 
        glue={"stepDefinition"})

public class TestRunner {

}

enter image description here

  1. The above solutions may work for Cucumber version 1.2.2.

In your case, if it is not working try to downgrade the Cucumber Lib version from 1.2.5 to 1.2.2

3
  • Did that features = {"features"}) But the error still is the full path name :java.lang.IllegalArgumentException: Not a file or directory: C:\Users\myuserid\Int_workspace\projectfolder\src\test\resources\features – anthony S. Apr 23 '18 at 14:01
  • 1
    why are you adding { } quotes??? – Bharat Mane Apr 23 '18 at 14:10
  • 3
    this will be useful only, if you are adding multiple parameters, isn't it?? – Bharat Mane Apr 23 '18 at 14:11
0

Please check whether you have added the correct path. If path is correct then check the jar you have added to the project. Jar version mismatch can lead to this problem. I am using cucumber 1.2.4 and it is working fine. Please check with this,

@CucumberOptions(
    plugin = {"pretty"},
    features = {"src//test//resources//features//"})

Check the permissions to the folder also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.