Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run maven test in junit window

I have a Java Project with maven in Eclipse. This project includes several Junit5 tests.

I have configured my pom.xml as followed:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.0</version>
    <configuration>
        <properties>
            <configurationParameters>
                junit.jupiter.execution.parallel.enabled = true
                junit.jupiter.execution.parallel.mode.default = concurrent
            </configurationParameters>
        </properties>
    </configuration>
</plugin>

I included my junit dependency as followed:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.5.1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.5.1</version>
    <scope>test</scope>
</dependency>

When I click right on my project I can choose Run As -> Junit Test. This will open the Junit View where I can see the process in a nice way and execute the tests without my maven settings.

When I click right on my project I can also choose Run As -> Maven test. This will open the console view, take my maven settings and will run the test. But I don't like the look of the console view.

So my question is: Is it possible to excute my project via Maven test to use my maven settings and let it run in the Junit view?

like image 860
alea Avatar asked Jan 29 '26 22:01

alea


1 Answers

The maven test outputs test results in target\surefire-reports\ directory.

You can take the XML with test results and drag&drop it to the Test View once the test completes, and the view will load and show the test results.

Caveats:

  • You won't see the progress, you can only do this once the test completes
  • Can only see one test (~ one test class) at a time, not complete test results
  • Quite inconvenient
like image 107
Jiri Tousek Avatar answered Feb 01 '26 13:02

Jiri Tousek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!