【问题标题】:behave: error: format=cucumber_json:PrettyCucumberJSONFormatter is unknown行为:错误:format=cucumber_json:PrettyCucumberJSONFormatter 未知
【发布时间】:2021-02-14 17:27:44
【问题描述】:

我正在尝试实现:https://docs.getxray.app/display/XRAY/Testing+using+Behave+in+Python

它正在为 Xray 测试管理工具生成黄瓜格式的报告。

但是在运行命令时:

behave --format=cucumber_json:PrettyCucumberJSONFormatter -o cucumber.json  --format=json -o behave.json

这给我一个错误:

表现:错误:format=cucumber_json:PrettyCucumberJSONFormatter 未知

尽管根据 Xray 的文档,我已将 cucumber_json.py 放在我的根目录中。

我的项目目录:

behave_example
    - features
        - steps
        - try.py
    - cucumber_json.py
    - __init__.py

你可以在这里找到 cucumber_json.py:https://docs.getxray.app/display/XRAY/Testing+using+Behave+in+Python

任何帮助将不胜感激。

【问题讨论】:

    标签: python testing automated-tests cucumber


    【解决方案1】:

    为了让 Python 加载实际文件夹中的自定义文件,您应该在带有代码的文件夹中设置此环境变量:

    export PYTHONPATH=`pwd`
    

    【讨论】:

    • 嗨。你能更具体一点吗?您指的是哪个带有代码的文件夹?
    • @MonicaVoinescu 您还应该从项目根文件夹的终端运行上述命令,假设您的 cucumber_json.py 在您的根文件夹中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 2011-04-16
    • 1970-01-01
    • 1970-01-01
    • 2020-11-18
    • 2021-08-14
    • 1970-01-01
    相关资源
    最近更新 更多