Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view the IntelliJ IDEA "Test Runner Tab" when running tests from maven?

In IntelliJ IDEA when I normally run a unit test I got a dialog that shows me test progress and lets me easily go through the test results. However, I'm using maven for my normal build process and would like to run my unit tests from maven as well. However, when I run my tests from maven instead of with Ideas default "Make" process the "Test Runner Tab" does not appear and I have to manually open the surefire report files in order to find out what went wrong.

So in short "How can I enable the pretty 'Test Runner Tab' for unit test run from a maven build?"

like image 589
Raystorm Avatar asked May 01 '13 19:05

Raystorm


2 Answers

You can run tests using the maven project window in IntelliJ View - Tool Windows - Maven Projects

Then under the project or module you wish to test open the lifecycle goals and click test.

This will run the currently configured test goal. Now the report is logged into the target directory

I use https://github.com/destin/maven-test-support-plugin to view the test results.

You can access this screen once the plugin is installed from the Project window again right click on the projects root and select "Show Test Results" (should be below the maven icon)

Good luck

like image 143
Narrim Avatar answered Oct 25 '22 19:10

Narrim


I recently figured out as close as I think I'll be able to get to an answer. The tests themselves have to be run from intellij-idea. But I can still configure IntelliJ IDEA to run the build via maven first.

Edit Run Debug Configuration

As you can see in the Red Highlighted Box I've selected a saved maven build configuration for it to run. So as not to duplicate tests, and keep things simple its a simple mvn package -DskipTests type build. I'm still curious if the tests are any different having IntelliJ IDEA run them vs the maven-surefire-plugin but now I at least know that the build process is the same.

like image 39
Raystorm Avatar answered Oct 25 '22 19:10

Raystorm