Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view the Maven Test results in Eclipse's "Junit View"

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?

like image 349
Raystorm Avatar asked Nov 08 '22 20:11

Raystorm


1 Answers

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.

like image 167
Tunaki Avatar answered Nov 14 '22 23:11

Tunaki