Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] m2e-wtp, handling JUnit tests the "right" way?


using Eclipse 4.3 and the m2e tooling that comes bundled with it, I am in some way lost setting things right to run JUnit tests from within the IDE. These are somewhat more complex maven war builds, yet they work. My experience so far:

- Adding a JUnit test to "src/test/java" and _immediately_ trying to run will fail almost for sure. At the very least I have to do a "mvn package" on the project(s) to be able to run the code.

- Changing an existing JUnit test and trying to run it, initially will result in the IDE spending quite some time doing building local dependencies that wouldn't be required to be rebuilt because they didn't changed ("Scoped incremental build..."). Sometimes, after that, test runs well, sometimes the IDE just complains about "The archive: /<project>/target/test-classes which is referenced by the classpath, does not exist."

- Overally, if I finally manage to run a JUnit test this way, it almost for sure will be the code that used to be in there during the last "mvn package" run... Sometimes, after that, the test will run. Sometimes, I'll just again run into ClassNotFoundException.

This feels rather ... difficult, ending me up with 2..5 minutes to even run a simple test, which is considerably too long. Is there any way to set this so it works the way one would assume it should (in terms of speed, too)? That's not really fun at the moment, not talking about being productive... :/

TIA and all the best,

Back to the top