按照設(shè)置行為的教程(https://behave.readthedocs.io/en/latest/tutorial.html),我收到一條ConfigError: No steps directory錯誤消息。我的文件結(jié)構(gòu):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"]到用戶設(shè)置中,修復(fù)了我的導(dǎo)入問題,但對這個 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貢獻(xiàn)1773條經(jīng)驗(yàn) 獲得超3個贊
我遇到了類似的問題。首先你需要確保你的文件夾路徑是正確的。第二件事,steps在您的項目文件夾中創(chuàng)建文件features夾?,F(xiàn)在運(yùn)行behave帶有功能文件名或不帶文件名的命令,它應(yīng)該可以工作。
├── feature [folder]
│ |── steps [folder]
├── filename.feature [file]

慕桂英4014372
TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超13個贊
您在 VisualStudio 中的工作目錄可能不正確。
提示:
打印命令行如何執(zhí)行行為
打印此執(zhí)行的當(dāng)前工作目錄(cmd-shell:
%CD%
)提供您自己的 python 腳本“my_behave.py”來運(yùn)行行為。它可以輕松地顯示/打印上面的診斷信息。
添加回答
舉報
0/150
提交
取消