按照设置行为的教程(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 回答
慕容3067478
TA贡献1773条经验 获得超3个赞
我遇到了类似的问题。首先你需要确保你的文件夹路径是正确的。第二件事,steps在您的项目文件夹中创建文件features夹。现在运行behave带有功能文件名或不带文件名的命令,它应该可以工作。
├── feature [folder]
│ |── steps [folder]
├── filename.feature [file]
慕桂英4014372
TA贡献1871条经验 获得超13个赞
您在 VisualStudio 中的工作目录可能不正确。
提示:
打印命令行如何执行行为
打印此执行的当前工作目录(cmd-shell:
%CD%)提供您自己的 python 脚本“my_behave.py”来运行行为。它可以轻松地显示/打印上面的诊断信息。
添加回答
举报
0/150
提交
取消
