所以我有问题在我的Maven项目中使用Intellij运行所有测试。原因是因为少数模块依赖于加载的dll中的Native方法。由于这个DLL不能被加载多次,我不得不在我的Maven POM文件中添加一个子句,这些测试将以分叉模式运行。Intellij/Maven单元测试运行问题
但是,在Intellij中,我无法弄清楚如何使这些相同的测试运行为分叉模式。我想利用Intellij漂亮的用户界面进行单元测试,并使用绿色栏和漂亮的UT界面,但是由于这个问题,我无法在我的项目中运行所有测试。
有没有人遇到与Maven,Intellij和Unit测试有关的问题,以及关于如何让它们在一起玩的很好的提示?
这里是我的pom.xml文件的一个片段:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>allTests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludes>
<exclude>**/pkgA/**/*Test.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>forkedTests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<forkMode>pertest</forkMode>
<includes>
<include>**/pkgA/**/*Test.java</include>
</includes>
<excludes>
<exclude>**/SpecificTest.java</exclude>
<exclude>**/*PerformanceTest.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>