首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python Behave ConfigError:[]中没有步骤目录

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

Stack Overflow用户
提问于 2019-08-27 00:54:51
回答 3查看 3.6K关注 0票数 0

按照设置behave (https://behave.readthedocs.io/en/latest/tutorial.html)的教程,我得到了一条ConfigError: No steps directory in error消息。

我的文件结构:

代码语言:javascript
复制
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

代码语言:javascript
复制
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

代码语言:javascript
复制
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!

我做错了什么?

EN

回答 3

Stack Overflow用户

发布于 2021-11-24 15:13:24

您可以尝试执行以下命令:

behave **/feature_file_name

票数 1
EN

Stack Overflow用户

发布于 2019-09-22 21:36:55

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

提示:

shell打印命令行how behave是如何执行的,并打印此执行的当前工作目录(cmd-

  • %CD%)
  • Provide您自己的python脚本"my_behave.py“以运行behave。它可以轻松地显示/打印上述诊断信息。
票数 0
EN

Stack Overflow用户

发布于 2021-02-24 17:22:28

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

代码语言:javascript
复制
├── feature [folder]
│   |── steps [folder]
├── filename.feature [file]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57661970

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档