It's all about the answers!

Ask a question

Debugging RQM JUnit Selenium Adatper


Daniel Chirillo (1801823) | asked Mar 27 '18, 9:38 a.m.

I'm trying to debug the adapter from Eclipse.  The challenge is that the adapter spawns a new java process to execute the test.  Is there a way to debug/step through the process that was spawned?  The best I've been able to do so far is to invoke (and debug) that Java process separately, but that doesn't give me what I really want, which is  to be able to debug the entire process  (from start to finish) of the adapter receiving the execution request, executing the test and then doing everything after the execution of the test completes.

2 answers



permanent link
Subhajit Bhuiya (6222) | answered Apr 03 '18, 3:25 a.m.
JAZZ DEVELOPER

You can put breakpoint in every thread. If it is library code, you may not be able to debug it.


permanent link
Daniel Chirillo (1801823) | answered Apr 03 '18, 7:44 a.m.
edited Apr 03 '18, 8:26 a.m.

It's not that simple.  I figured it out.  You can't just put a breakpoint since the JUnit test runs in a separate process (created with ProcessBuilder), not a separate thread in the command line adapter's 'main' process.  You need to create a remote debug connection to the process that runs the JUnit tests.

What I did was:

1.  In CommandLindAdapter.runTest(), added the argument to start the new java process in debug mode:
commandLine.append(args[0] + " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 ");

2.  Put breakpoint in QMCommandLindAdapter.main() so that I could debug the main adapter process as soon as it starts.

3.  In JUnitLauncher.main(), put a 10-second sleep to give me time to connect to the java process after it has been spawned by the adapter's main process.

4.  Put a breakpoint in JUnitListener.main() right after the sleep

5.  Ran the adapter in debug mode (from Eclipse)

6.  Kicked off the test from QM and then connected to the java process by launching a remote debug connection from Eclipse.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.