I'm using Eclipse Oxygen for Java developers on Mac OS. I have imported my Maven projects into the IDE. Normally, at the command line, when I run a test, I'll run something like
mvn test -Dtest=UserServiceTest
In addition to running the "test" goal, this will also execute some custom code I have in the "process-resources" and "test-compile" goals. However, when I run my test in the Eclipse IDE (by right clicking on the class name in the package explorer, selecting "Run" and then selecting "JUnit Test"), I notice these other goals aren't run.
Is there a way to globally set up my project so that when I run a JUnit test, it automatically behaves like typing the command above? I realize I could individually edit the run configuration for each test, but since I have hundreds, this would take a lot of work and I'd have to do it each time I crated a new test. It would be great if there were some global way to set up Eclipse to do ti for me.
Currently, Eclipse has no such built-in workspace or project settings/preferences and I do not know any plug-in for the desired feature.
The so-called Launch Configuration Templates/Prototypes (see also Eclipse bug 41353 ) are currently being developed and are expected to be shipped with Eclipse Photon on June 27, 2018 .
Consider changing your tests so that they can be run on a local machine without additional parameters , eg via @BeforeClass
(JUnit 4) or @BeforeAll
(JUnit 5).
No solution, but tips how to avoid a few mouse clicks in this context:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.