首页 > 解决方案 > 无法使用 Gauge 框架启动 VSCode 调试器

问题描述

软件版本:

我有一个基于 Python 设置的 Gauge 框架。我有一个规范文件,安装了场景。我还在胶水代码中设置了一个断点。当我单击 Debug Spec 超链接时,我收到一条错误消息,内容如下:

无法启动调试器:调试器不适用于独立文件。请打开文件夹 c:\Projects\IAS_Desktop_Automation\ias_desktop_automation。

错误 GIF

请告诉我如何让调试器工作。

更新:我也从 gauge.log 获得了日志文件结果

09-09-2021 11:06:34.700 [Gauge] [DEBUG] Created gauge_screenshots_dir at c:\Projects\GaugeFramework\ias_net_automation\reports\html-report\screenshots
09-09-2021 11:06:34.701 [Gauge] [INFO] Compatible version of plugin python not found. Installing plugin python...
09-09-2021 11:06:34.701 [Gauge] [DEBUG] Gathering metadata for python
09-09-2021 11:06:34.703 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/python?l=python&p=html-report,python,screenshot,xml-report&o=windows&a=amd64
09-09-2021 11:06:35.105 [Gauge] [DEBUG] Plugin python 0.3.17 is already installed.
09-09-2021 11:06:35.106 [Gauge] [DEBUG] Plugin html-report is already installed.
09-09-2021 11:06:35.107 [Gauge] [DEBUG] Plugin screenshot is already installed.
09-09-2021 11:06:35.107 [Gauge] [DEBUG] Parsing started.
09-09-2021 11:06:35.107 [Gauge] [DEBUG] Started concepts parsing.
09-09-2021 11:06:35.144 [Gauge] [DEBUG] 38 concepts parsing completed.
09-09-2021 11:06:35.144 [Gauge] [DEBUG] Started specifications parsing.
09-09-2021 11:06:35.144 [Gauge] [DEBUG] 1 specifications parsing completed.
09-09-2021 11:06:35.144 [Gauge] [DEBUG] Parsing completed.
09-09-2021 11:06:35.504 [Gauge] [DEBUG] Checking updates...
09-09-2021 11:06:35.505 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/html-report?l=python&p=html-report,python,screenshot,xml-report&o=windows&a=amd64
09-09-2021 11:06:35.675 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/python?l=python&p=html-report,python,screenshot,xml-report&o=windows&a=amd64
09-09-2021 11:06:35.696 [python] [INFO] Python: 3.9.7
09-09-2021 11:06:35.696 [python] [DEBUG] Loading step implementations from c:\Projects\GaugeFramework\ias_net_automation\step_impl dirs.
09-09-2021 11:06:35.771 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/screenshot?l=python&p=html-report,python,screenshot,xml-report&o=windows&a=amd64
09-09-2021 11:06:35.978 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/xml-report?l=python&p=html-report,python,screenshot,xml-report&o=windows&a=amd64
09-09-2021 11:06:41.804 [python] [INFO] Runner Ready for Debugging

这是 lsp.log 中的一个,其中可能包含一些更具启发性的信息:

09-09-2021 11:07:16.033 [Gauge] [DEBUG] jsonrpc2: --> request #7: textDocument/codeLens: {"textDocument":{"uri":"file:///c%!!(MISSING)A(MISSING)/Projects/GaugeFramework/ias_net_automation/specs/testData.spec"}}
09-09-2021 11:07:16.033 [Gauge] [DEBUG] jsonrpc2: <-- result #7: textDocument/codeLens: [{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":12}},"command":{"title":"Run Scenario","command":"gauge.execute","arguments":["c:\\Projects\\GaugeFramework\\ias_net_automation\\specs\\testData.spec:3"]}},{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":14}},"command":{"title":"Debug Scenario","command":"gauge.debug","arguments":["c:\\Projects\\GaugeFramework\\ias_net_automation\\specs\\testData.spec:3"]}},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":8}},"command":{"title":"Run Spec","command":"gauge.execute","arguments":["c:\\Projects\\GaugeFramework\\ias_net_automation\\specs\\testData.spec"]}},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":10}},"command":{"title":"Debug Spec","command":"gauge.debug","arguments":["c:\\Projects\\GaugeFramework\\ias_net_automation\\specs\\testData.spec"]}}]

标签: vscode-debuggergetgauge

解决方案


此问题是由最新的仪表扩展更新(版本 0.0.21)引入的

  1. 将您的自动更新扩展更改为无
  2. 将 vscode 中的仪表扩展下调至 0.0.20

您可以在“版本历史记录”选项卡下从此处获取版本 20: https ://marketplace.visualstudio.com/items?itemName=getgauge.gauge#install-from-source

将下载文件放在您的工作区中,然后在终端中运行以下命令:

code --install-extension getgauge.gauge-0.0.20.vsix

推荐阅读