Behave Runner in PyCharm Error-ing Out Due to some Feature Structure Problem - behave.parser.ParserError:

Behave Runner in PyCharm Error-ing Out Due to some Feature Structure Problem - behave.parser.ParserError:

问题:这在 PyCharm 中突然停止工作,并且自然语言代码背后的功能只有微小的变化。 Behave Runner 出错了 - 如果您 运行 解决了这个问题并修复了它,请提供帮助。我已经对整个回购进行了编码,但看不到问题所在。也许我遗漏了什么,以前从未遇到过这个问题运行进行相同的测试

Feature: Opportunity End Point in AWS ~ DEV, SIT - ENVIRONMENT'S
  Generate an Opportunity Response


  Scenario Outline: Generate an Opportunity Payload for AWS-DEV
    Given we have an opportunity request payload in <AWS-ENVIRONMENT>
    When we submit the post call for the opportunity response <AWS-ENVIRONMENT>
    Examples:
    | AWS-ENVIRONMENT |
    |     AWS_DEV     |


  Scenario Outline: Generate an Opportunity Payload for AWS-DEV and Extract Div Names and Opportunity Count by Divs
    Given we have an opportunity request payload with subset of all accounts in <AWS-ENVIRONMENT>
    When we post the string payload with subset of all accounts in nutrien for AWS-DEV
    Then we extract the rationle embedded within the returned opportunity json
    And we extract unique Divisions within the opportunity response rationale
    And verify the number of occurances of division title in the opportunities Response Payload
    And we extract the opportunity Ids and unique occurances
    Examples:
     | AWS-ENVIRONMENT |
     |   AWS_DEV_ALL   |

错误堆栈跟踪:

Testing started at 1:18 PM ... Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/behave_runner.py", line 327, in _BehaveRunner(my_config, base_dir, use_old_runner).run() File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_bdd_utils.py", line 102, in run number_of_tests = self._get_number_of_tests() File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_bdd_utils.py", line 221, in _get_number_of_tests for feature in self._get_features_to_run(): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/behave_runner.py", line 235, in _get_features_to_run self.__real_runner.run() File "lib/python3.8/site-packages/behave/runner.py", line 804, in run return self.run_with_paths() File "lib/python3.8/site-packages/behave/runner.py", line 818, in run_with_paths features = parse_features(feature_locations, language=self.config.lang) File "lib/python3.8/site-packages/behave/runner_util.py", line 326, in parse_features feature = parser.parse_file(filename, language=language) File "lib/python3.8/site-packages/behave/parser.py", line 18, in parse_file return parse_feature(data, language, filename) File "/lib/python3.8/site-packages/behave/parser.py", line 26, in parse_feature result = Parser(language).parse(data, filename) File "/lib/python3.8/site-packages/behave/parser.py", line 148, in parse self.action(line) File "/lib/python3.8/site-packages/behave/parser.py", line 282, in action raise ParserError(msg, self.line, self.filename, line) behave.parser.ParserError: Failed to parse "/tests/aws/features/xxxxx.feature":

Parser in unknown state features; at line 8: "When we submit the post call for the opportunity response "

Process finished with exit code 1

指向 Gherkin/Behave Runner 的虚拟环境以某种方式损坏了 基本上,如果您看到此错误,请使用 requirements.txt 重新安装 VLENV,然后 Runner 应该开始工作。

所以步骤

  • 销毁 vlenv
  • 重新创建具有相关依赖项的 vlenv
  • 将 vlenv 配置为 PyCharm
  • 中的 python 解释器设置
  • re 运行 行为 运行ner