Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Running single JUnit tests with maven in Eclipse

Thanks a lot for your many answers.

Maybe I can try to clarify my point:

Currently there is a "Run as > Maven test" (provided by the eclipse maven integration). You can invoke this on a project having the maven nature. As pointed by Igor Fedorenko, this is shortcut for "mvn test".

Currently there is an Eclipse "Run as > JUnit Test" (provided by eclipse jdt). This works great but is not the same as "mvn -Dtest=XxxxYyyyyTest#testAbc test" because Eclipse and maven do not run the tests the same way. (as pointed out by James Nord).

@Rafał: thanks for your pointer. I imagine, it will work, because it correspond to what can be achieve on the command line.


The feature I am looking for is like the current "Run as > JUnit Test" on a test class/method, the possibility to start maven: "Run as > Maven test (with the selected class/method as test parameter)". The test should be executed "the maven way" (I assume that it depends on the configurations in the pom).

A second step could be to collect the test result produced by maven and display them in the JUnit view in Eclipse. This step is a "nice to have".


I hopes it is clearer now.

Regards,

Jérémie.


Von: m2e-users-bounces@xxxxxxxxxxx [m2e-users-bounces@xxxxxxxxxxx]" im Auftrag von "Tonio Caputo [tonioc@xxxxxxxxxxx]
Gesendet: Mittwoch, 20. Februar 2013 16:37
Bis: Maven Integration for Eclipse users mailing list
Betreff: Re: [m2e-users] Running single JUnit tests with maven in Eclipse

Hi,

Perhaps I may be missing the point, but if I understood this correctly it is already there.

If you get into your test class, select the method name, open context menu
and click JUnit Test, only the selected method will run (in the run menu you
will see something like MyTestClass.myTestMethod after running it).

If I'm missing the point sorry for it :-)
tonio



On Wed, Feb 20, 2013 at 11:05 AM, Jeremie Bresson <Jeremie.Bresson@xxxxxxxxx> wrote:
Hi,

According to this stackoverflow question [1], it is possible to run a single test with maven (I am new to maven):
  mvn -Dtest=XxxxYyyyyTest#testAbc test

I am looking for the same function in Eclipse (I assume it could be implemented in m2e):

On a JUnit java file, in a maven project, I want a menu "Run As... > Maven JUnit Test"

The first approach is to start maven run the specific selected test class (and even test method).
A very good integration would display the test result in the JUnit view and allow to rerun a specific test.

* Do you know if such a function exists?
* Is there some interest for m2e (as enhancement bug) or should it be implemented in a separate plugin?

Side note: I had a quick look at the jdt code. There is a JunitLaunchConfigurationDelegate class (org.eclipse.jdt.junit.core) and an extension point.

Thanks a lot for your inputs.

Jeremie Bresson.


[1] http://stackoverflow.com/questions/1873995/run-a-single-test-method-with-maven

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users


Attachment: smime.p7s
Description: S/MIME cryptographic signature


Back to the top