Run Junit test remotely as if it were running locally using Eclipse

I've searched, read related questions on this site and others, but couldn't find a solution. It seems strange to me that this doesn't exist, so let me expand on my question in detail here:

I use Junit4 + Eclipse regularly for code review. In some cases, some tests can take up a lot of CPU and / or memory, making my workstation unusable for the entire test. This is the pain I'm trying to solve.

I'm looking to get the same behavior but via a remote server. I want to:

  • To still be able to set breakpoints and debug my application.
  • To see how tests run using Junit view in Eclipse.
  • Click the button to start the tests (build process and file copying are allowed, but only if they are effective).

In my imagination I imagine something that rsyncs files to a remote server, starts a java process there with the same arguments as on my local machine, makes a debug port (not just localhost) available, and has an eclipse all the way to work both debug and junit.

How can i do this?

Several leading questions that can help us find a solution:

  • How does Eclipse communicate with the java process when launched locally (both for debugging purposes and Junit view)?
  • How can I get myself involved in creating a java process to test JUnit so that I can copy the required files to the remote server?
  • How can I get the process to run remotely and not locally?
  • How can I connect Eclipse to a remote host instead of localhost?

source to share

2 answers

The easiest way would be to invoke the JUnit runner command line on the remote machine using the following command:

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y,suspend=y -cp ... org.junit.runner.JUnitCore <test class name>


So it will wait until you attach a remote debugger from Eclipse on port 8998.

You can also use the Eclipse Target Management tools to transfer files to a remote system and run remote commands. There are several tutorials on the project page.



You can set up a jenkins CI server, sync your code via git (or just copy with ftp or whatever), execute the test in a jenkins job initiated by git -hook or through some script, Then suggested a remote debug process in the current test process , for example, Evgeny Kuleshov. This process can be automated with an ant - script that you call from eclipse. There should be a mylin connector ( for example ) through which you can track your current tests. I don't know if the standard JUnit view for eclipse can be used to view the current tests without using some custom plugins (if they exist).



All Articles