在做单元测试,Debug启动方法提示“Connected to the target VM, address: '127.0.0.1:11640', transport: 'socket'”

在做单元测试,Debug启动方法提示“Connected to the target VM, address: ‘127.0.0.1:11640’, transport: ‘socket’”

直接上问题:

在做单元测试,Debug启动方法提示“Connected to the target VM, address: '127.0.0.1:11640', transport: 'socket'”
在做单元测试,Debug启动方法提示“Connected to the target VM, address: '127.0.0.1:11640', transport: 'socket'”
经过很长时间的排查,发现在使用Junit做单元测试时,Test方法是不可以携带参数的,否则就不会执行测试方法,并且不会打印任何日志信息,只有debug调试才会有上图的日志。

解决方法:

删除测试方法中携带的参数,如下图:
在做单元测试,Debug启动方法提示“Connected to the target VM, address: '127.0.0.1:11640', transport: 'socket'”
运行结果:
在做单元测试,Debug启动方法提示“Connected to the target VM, address: '127.0.0.1:11640', transport: 'socket'”

如有不对之处,敬请留言,非常感谢!