Run single junit tests

281 views
Skip to first unread message

amo...@gmail.com

unread,
May 19, 2013, 2:25:15 PM5/19/13
to emacs...@googlegroups.com
Hi all emacs eclim users,

Is there any way to execute single tests defined in the current buffer?  Ideally I am looking for the ability to execute specific test methods as is possible in Eclipse using right "click > run as > JUnit test", however, the ability to run all test methods in the file would also suffice.  Using maven to run the entire test suite is impractical for my project as test execution takes too long.

If this isn't possible, is there any workaround that you are using for this feature?

Cheers,
Dave

Eric Van Dewoestine

unread,
May 20, 2013, 4:51:39 PM5/20/13
to emacs...@googlegroups.com
Since you haven't gotten a response from someone more knowledgeable of
the emacs-eclim code base yet, I figured I'd chime in and at least let
you know that the eclim daemon does support running all tests, a
single test class, or a single test method, all using the java_junit
command. I'm not familiar enough with the emacs-eclim code base to
say whether it has the ability to leverage that command yet or not
though.

--
eric

fred-o

unread,
May 21, 2013, 3:38:21 PM5/21/13
to emacs...@googlegroups.com
Hi, 

Welllll, 'technically' it's possible (as Eric says), it's just that no-one has gotten around to writing the client code for it yet. Looking at the eclim documentation I don't think it would be too complicated as the support is all there. 

I don't have as much time and energy to devote to emacs-eclim as I'd like right now, so if anyone would like to have a go at this, feel free to do so.

Cheers,
-- Fredrik

Tom Davis

unread,
Jul 30, 2013, 11:39:51 AM7/30/13
to emacs...@googlegroups.com
Here you go, just run this from inside a TestCase you want to execute.

(defun eclim-run-test ()
  (interactive)
  (if (not (string= major-mode "java-mode"))
    (message "Sorry cannot run current buffer."))
  (compile (concat eclim-executable " -command java_junit -p " eclim--project-name " -t " (eclim-package-and-class))))
Reply all
Reply to author
Forward
0 new messages