按照设置behave (https://behave.readthedocs.io/en/latest/tutorial.html)的教程,我得到了一条ConfigError: No steps directory in error消息。
我的文件结构:
VS Code/TestingAutomationPOC/
VS Code/TestingAutomationPOC/features/
VS Code/TestingAutomationPOC/features/steps/
VS Code/TestingAutomationPOC/features/steps/tutorial.py
VS Code/TestingAutomationPOC/feature/tutorial.feature通过pip安装behave (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!我做错了什么?
发布于 2021-11-24 15:13:24
您可以尝试执行以下命令:
behave **/feature_file_name
发布于 2019-09-22 21:36:55
您在VisualStudio中的工作目录可能不正确。
提示:
shell打印命令行how behave是如何执行的,并打印此执行的当前工作目录(cmd-
%CD%)发布于 2021-02-24 17:22:28
我也遇到过类似的问题。首先你需要确保你的文件夹路径是正确的。第二件事,在你的项目features文件夹中创建steps文件夹。现在,使用功能文件名或不使用文件名来运行behave命令,它应该可以工作。
├── feature [folder]
│ |── steps [folder]
├── filename.feature [file]https://stackoverflow.com/questions/57661970
复制相似问题