I just installed the plugin m2e for the first time on Eclipse.
I wrote a simple JUnit (version 4) test. I can run it from Eclipse, but not from the pom.xml (alt-click, Run as, Maven Test). I suppose I need to tell Maven to search for that class, but I just don't know how.
Also, I couldn't find JUnit 4 in the groupId "junit": only the version 3.8.1 is available. Do I really need to write tests for version 3.x and not version 4+?
How to fix this?
Think of me as a newbie with Maven: that's exactly what I am. So please don't speak about artifact technobabble unless describing exactly what I need to do. I could barely install Guava as dependency and I'm completely lost right now with these concepts.
Thanks!
you can run Junit 4 with Maven. You just need the Junit 4 dependency in your pom. You also need the surefire plugin to execute the tests. Hint: By default surefire looks for files with *Test.
We can run our unit tests with Maven by using the command: mvn clean test. When we run this command at command prompt, we should see that the Maven Surefire Plugin runs our unit tests. We can now create a Maven project that compiles and runs unit tests which use JUnit 5.
you can run Junit 4 with Maven. You just need the Junit 4 dependency in your pom. You also need the surefire plugin to execute the tests.
See: http://maven.apache.org/plugins/maven-surefire-plugin/
Hint: By default surefire looks for files with *Test.java
naming to find tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With