为了账号安全,请及时绑定邮箱和手机立即绑定

Python Behave - ConfigError:[] 中没有步骤目录

Python Behave - ConfigError:[] 中没有步骤目录

Smart猫小萌 2022-05-11 14:48:52
按照设置行为的教程(https://behave.readthedocs.io/en/latest/tutorial.html),我收到一条ConfigError: No steps directory错误消息。我的文件结构:VS Code/TestingAutomationPOC/VS Code/TestingAutomationPOC/features/VS Code/TestingAutomationPOC/features/steps/VS Code/TestingAutomationPOC/features/steps/tutorial.pyVS Code/TestingAutomationPOC/feature/tutorial.feature通过 pip 安装行为(1.2.6)。添加"python.linting.pylintArgs": ["--load-plugin","pylint_protobuf"]到用户设置中,修复了我的导入问题,但对这个 ConfigError 没有帮助。来自tutorial.py:from behave import *@given('we have behave installed')def step_impl(context):    pass@when('we implement a test')def step_impl(context):    assert True is not False@then('behave will test it for us!')def step_impl(context):    assert context.failed is False来自tutorial.feature:Feature: showing off behave  Scenario: run a simple test     Given we have behave installed      When we implement a test      Then behave will test it for us!我究竟做错了什么?
查看完整描述

3 回答

?
慕哥6287543

TA贡献1831条经验 获得超10个赞

你可以试试这个命令:

behave **/feature_file_name


查看完整回答
反对 回复 2022-05-11
?
慕容3067478

TA贡献1773条经验 获得超3个赞

我遇到了类似的问题。首先你需要确保你的文件夹路径是正确的。第二件事,steps在您的项目文件夹中创建文件features夹。现在运行behave带有功能文件名或不带文件名的命令,它应该可以工作。


├── feature [folder]

│   |── steps [folder]

├── filename.feature [file]


查看完整回答
反对 回复 2022-05-11
?
慕桂英4014372

TA贡献1871条经验 获得超13个赞

您在 VisualStudio 中的工作目录可能不正确。

提示:

  • 打印命令行如何执行行为

  • 打印此执行的当前工作目录(cmd-shell: %CD%

  • 提供您自己的 python 脚本“my_behave.py”来运行行为。它可以轻松地显示/打印上面的诊断信息。


查看完整回答
反对 回复 2022-05-11
  • 3 回答
  • 0 关注
  • 662 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号