python - 无法运行仪表测试 - connectex:无法建立连接,因为目标机器主动拒绝它
问题描述
我正在使用仪表和 python 开发一些测试,但是在运行规范时我收到连接错误,我检查仪表错误并发现 grpc 正在打开 65271 上的连接并且端口 65268 抛出错误。
我错过了什么(这是我的第一次尝试)?
19-01-2021 17:20:38.022 [python] [INFO] Python: 3.9.0
19-01-2021 17:20:38.022 [python] [DEBUG] Loading step implementations from C:\workspace\test_gauge\step_impl dirs.
19-01-2021 17:20:38.061 [python] [DEBUG] Starting grpc server..
19-01-2021 17:20:38.066 [Gauge] [DEBUG] Attempting to connect to grpc server at port: 65268
19-01-2021 17:20:38.067 [Gauge] [DEBUG] Successfully made the connection with runner with port: 65268
19-01-2021 17:20:38.067 [Gauge] [DEBUG] Validation started.
19-01-2021 17:20:38.075 [Gauge] [DEBUG] Validation completed.
19-01-2021 17:20:38.075 [Gauge] [DEBUG] Run started
19-01-2021 17:20:38.076 [Gauge] [DEBUG] Starting Html Report plugin
19-01-2021 17:20:38.083 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/python?l=python&p=html-report,java,python,screenshot&o=windows&a=amd64
19-01-2021 17:20:38.103 [Gauge] [DEBUG] Attempting to connect to grpc server at port: 65271
19-01-2021 17:20:38.103 [Gauge] [DEBUG] Successfully made the connection with plugin with port: 65271
19-01-2021 17:20:38.103 [Gauge] [DEBUG] Initialising suite data store.
19-01-2021 17:20:38.176 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/screenshot?l=python&p=html-report,java,python,screenshot&o=windows&a=amd64
19-01-2021 17:20:38.217 [python] [CRITICAL] Exception occurred while loading step implementations from file: step_impl\webui\pages\login_page.py.
19-01-2021 17:20:38.220 [Gauge] [ERROR] Error Message: transport is closing
19-01-2021 17:20:38.220 [Gauge] [ERROR] Stacktrace:
19-01-2021 17:20:38.220 [Gauge] [ERROR] Error Message: Runner is not Alive
19-01-2021 17:20:38.220 [Gauge] [ERROR] Stacktrace:
19-01-2021 17:20:38.221 [html-report] [DEBUG] Transformed SuiteResult to report structure
19-01-2021 17:20:38.231 [Gauge] [ERROR] Error occurred while waiting for runner process to finish.
Error : exit status 1
19-01-2021 17:20:38.251 [Gauge] [DEBUG] Sending kill message to Html Report plugin.
19-01-2021 17:20:38.251 [html-report] [INFO] Successfully generated html-report to => C:\workspace\test_gauge\reports\html-report\index.html
19-01-2021 17:20:38.251 [html-report] [DEBUG] Done generating HTML report using theme from C:\Users\imrankhan\AppData\Roaming\gauge\plugins\html-report\4.0.12\themes\default
**19-01-2021 17:20:40.221 [Gauge] [ERROR] Failed to kill Runner: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:65268: connectex: No connection could be made because the target machine actively refused it."**
19-01-2021 17:20:40.221 [Gauge] [INFO] Specifications: 0 executed 0 passed 0 failed 0 skipped
19-01-2021 17:20:40.222 [Gauge] [INFO] Scenarios: 0 executed 0 passed 0 failed 0 skipped
19-01-2021 17:20:40.222 [Gauge] [INFO]
Total time taken: 145ms
19-01-2021 17:20:40.224 [Gauge] [INFO] Updates are available. Run `gauge update -c` for more info.
解决方案
当我昨天查看日志并进行了很多调查时,看起来这个问题的根本原因不是仪表,而是我自己的脚本(我相信你也是)
请注意,有一个关键行“[python] [CRITICAL] 从文件加载步骤实现时发生异常:step_impl\webui\pages\login_page.py。” 在您的日志中,这是一个标志,让您知道您的 python 脚本有问题。如果你不弄清楚你的 python 脚本出了什么问题,这个问题将一直存在。
从表面上看,还有另一个问题,即 gauge runner 阻止了要显示的 python 脚本(和我的)的详细错误,这误导我们指出了 gauge runner 而不是 python 脚本的根本原因。
简而言之,gauge runner 不会打印出 python 脚本的详细错误日志,但是有。
推荐阅读
- html - Django 变量未显示
- jquery - 基于 data-x-toggleable 的 Jquery 隐藏/显示 Div
- sparql - 从 Wikidata 检索结果时超时
- python-3.x - 无头模式下的 Selenium 不适用于用户配置文件
- latex - 我怎么能找到为什么我相同的乳胶代码会产生不同的结果?
- azure - 如何使用逻辑应用将事件从 azure 事件中心传输到 azure blob 存储?
- python-3.x - 我在传递参数时做错了什么?
- python - 如何从python中的字典中获取后续键?
- c - 为什么在以下情况下使用赋值运算符而不是等于运算符?
- java - 弹性4j重试改造