【问题标题】:Unable to start the VSCode debugger with the Gauge Framework无法使用 Gauge 框架启动 VSCode 调试器
【发布时间】:2021-09-08 14:09:19
【问题描述】:

软件版本:

  • Python:3.9.7
  • 量规:1.4.1
  • Visual Studio 代码:1.60.0
  • VSCode 的仪表插件 (getgauge.gauge):v0.0.21
  • Pylance (ms-python.vscode-pylance):v2021.9.0

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

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

Error 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-debugger getgauge


【解决方案1】:

此问题是由最新的仪表扩展更新(版本 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

【讨论】:

  • 我试过这个,不幸的是没有为我工作。在 MacOS 和 Windows 10 上测试。我的错误消息改为显示“无法创建测试资源管理器”,并且代码提示(运行/调试超链接)根本不呈现。也没有 IntelliSense。
【解决方案2】:

我将 VSCode 的 Gauge 插件恢复到 v0.0.20 并且调试器按预期工作。

enter image description here

github中提出了一个问题看最新版本的问题:https://github.com/getgauge/gauge-vscode/issues/726

【讨论】:

    【解决方案3】:

    我们最近使用 python 3.7.3 并在升级到 VSC 1.60 后看到了这一点。

    我按照建议使用 python 3.9.7、VSC 1.60 和 gauge 0.0.20 进行了尝试,但我仍然遇到调试器装饰器没有出现的问题,只有“运行场景” "

    我收到这条消息:

    仪表无法初始化。安装“ms-python.python”扩展以获取代码洞察。有关详细信息,请参阅问题,检查日志。Troublesh

    我安装了 python VSC ms-python.python 扩展:v2021.9.1218897484

    我正在尝试一个“虚拟”项目,默认是 gauge init python 在本地安装 Gauge 1.41 后运行的结果

    忘了说,Windows 10 系统

    【讨论】:

      猜你喜欢
      • 2018-01-10
      • 1970-01-01
      • 1970-01-01
      • 2022-11-24
      • 1970-01-01
      • 2023-03-06
      • 2021-04-15
      • 1970-01-01
      • 2020-02-04
      相关资源
      最近更新 更多