我正在尝试使用 ctrl + shift + d (换句话说:上下文菜单 - >调试)在IntelliJ中使用Gradle调试我的Spock测试。
但不幸的是,它失败了以下输出:
Testing started at 12:13 ...
12:13:42: Executing external tasks 'cleanTest test --tests "com.***.MyTest.test1"
:cleanTest
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
Connected to the target VM, address: '127.0.0.1:60991', transport: 'socket'
Disconnected from the target VM, address: '127.0.0.1:60991', transport: 'socket'
ERROR: transport error 202: connect failed: Connection refused
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
Process 'Gradle Test Executor 3' finished with non-zero exit value 134
org.gradle.process.internal.ExecException: Process 'Gradle Test Executor 3' finished with non-zero exit value 134
有趣的是,简单的运行测试正在传递。 我是在Mac,IntelliJ 15上开始的。
答案 0 :(得分:0)
你的问题与Spock无关。似乎调试端口有问题。 运行测试不会使用调试端口,因此它当然会通过。
关闭所有应用程序,重新启动并检查端口60991是否真的免费。 另请检查您是否没有阻止此端口的个人防火墙。