2

I'm debugging a unit test in a large java project. I need to run 'ant test ...' to launch the test suite. So it's difficult for me to launch it from the IDE. Is it possible to call some function like Debugger.Break() in C# to break into the debugger if it's attached to any debugger?

woodings
  • 7,503
  • 5
  • 34
  • 52
  • 1
    You mention C# in the description, but the question is tagged as java. Which one is it? Also, why can't you run your test from the IDE? – alfredaday Sep 26 '12 at 07:18

1 Answers1

2

If I am understanding your question correctly, you can use java's remote debugging by setting these 2 jvm parameters:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044

And for debugging your ant task you can add the these parameters in your ant <java> task. For details you may follow java debug options in ant link.

Kuldeep Jain
  • 8,409
  • 8
  • 48
  • 73
  • Thanks @KuldeepJain! I added this to my build.xml. But it won't break during 'ant test'. I won't be able to attach my debugger to the running test. – woodings Sep 27 '12 at 19:52