简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM