I'm using eclipse for my IDE. I'm using Maven to build / release my code. Ideally I'd like to only have 1 build engine. To that end I want to make sure that I build/test the code the same way everytime.
However, the Junit View in Eclipse is nice an easy to use. I'd like to keep using it while debugging my tests.
A couple years ago I managed to do this with Intellij IDEA, so I figure something similar should be possible in Eclipse.
How can I build (and hopefully test) with Maven and then view the results of testing in Eclipse?
The maven-surefire-plugin
generates reports after executing the tests, that are located by default in target/surefire-reports
:
The Surefire Plugin is used during the
test
phase of the build lifecycle to execute the unit tests of an application. It generates reports in two different file formats:
- Plain text files (
*.txt
)- XML files (
*.xml
)By default, these files are generated at
${basedir}/target/surefire-reports
.
As such, after the tests are executed, you just need to open those reports in Eclipse by double-clicking them.
If you open the XML reports, Eclipse will, by default, open the JUnit view and you will have the same presentation as you're used to when running the test directly in Eclipse.
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