在使用Ant的Eclipse中调试TestNg Java代码 [英] Debug TestNg java code in eclipse that uses Ant

查看:121
本文介绍了在使用Ant的Eclipse中调试TestNg Java代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Eclipse(Mars)中调试一个项目,该项目使用TestNg和Apache Ant进行自动化测试以进行构建.使用可用的解决方案,我可以调试ant build.xml文件,但是Java代码中的断点不会出现.谁能帮助我解决如何调试Java源文件,特别是在Eclipse中测试用例的问题?

I am trying to debug a project in Eclipse(Mars) that does test automation using TestNg and Apache Ant for build. With the available solutions, I am able to debug ant build.xml file, but breakpoints inside java code are not hitting. Can anyone please help me with this on how to debug java source files, especially the test cases in my case in eclipse?

谢谢.

推荐答案

我想出了解决此问题的方法.请按照以下步骤解决此问题
1.在build.xml文件的任务内添加以下行.

I figured the solution to this problem. Follow the following steps to solve this
1. Add following lines inside the task in build.xml file.

<jvmarg value="-Xdebug" />
<jvmarg value="-Xnoagent"/> 
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432" />

  1. 添加远程Java应用程序调试配置,即,指定项目名称,将主机指定为"localhost",并在本例中将端口与步骤1中的5432相同
  2. 首先调试build.xml文件
  3. 通过开始调试在步骤2中设置的远程Java应用程序调试配置来附加testng进程.

这篇关于在使用Ant的Eclipse中调试TestNg Java代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆