0

I'm having a problem running one of my feature files. I can run one of them but not the other. I have the exact same setup for run configurations for both.

raise ParserError(msg, None, self.filename)
behave.parser.ParserError: Failed to parse "C:\project\test.feature": 
Parser failure in state init, at line 1
REASON: No feature found.

If I change the configuration I get:

"C:\Program Files (x86)\Python\pythonw.exe" -m behave "C:\Program Files (x86)\JetBrains\PyCharm 2017.1\helpers\pycharm\behave_runner.py"
Testing started at 16:41 ...
ConfigError: No steps directory in "C:\Program Files (x86)\JetBrains\PyCharm 2017.1\helpers\pycharm"
Sam
  • 1,207
  • 4
  • 26
  • 50
  • I'm running them in a terminal in the features folder by just using the command behave. It's not cucumber it's gherkin. Steps is inside a folder called steps and im using python – Sam Mar 28 '17 at 16:50

2 Answers2

1

A problem could be the file encoding. Behave does not seem to play well with utf-8 files with BOM. For me, removing the bom worked. In Pycharm, go to File -> Remove BOM

yanlend
  • 450
  • 3
  • 10
0
behave.parser.ParserError: Failed to parse "C:\project\test.feature": 
Parser failure in state init, at line 1
REASON: No feature found.

It seems you've missed to add feature name on Feature section in your gherkin file.

Your test.feature file structure should be like :

Feature: feature name

  Scenario: some scenario
      Given some condition
       Then some result is expected.

I'm running them in a terminal in the features folder by just using the command behave. It's not cucumber it's gherkin. Steps is inside a folder called steps and im using python

Make sure your project has the proper behave directory structure:

features/
features/everything.feature
features/steps/
features/steps/steps.py

Try to run your script from outside features folder:

behave features/everything.feature
Raja David
  • 304
  • 7
  • 16