如何按字母顺序运行Maven集成测试?

时间:2017-02-28 21:33:13

标签: maven integration-testing maven-failsafe-plugin

我在Java 1.8中使用Maven 3.3.3。如何通过类名(或文件,更简单)使我的集成​​测试按字母顺序运行?我认为“runOrder”可能对我有所帮助,所以我创建了这个插件配置......

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <reuseForks>true</reuseForks>
        <argLine>-Xmx4096m -XX:MaxPermSize=512M -noverify -XX:-UseSplitVerifier ${itCoverageAgent}</argLine> 
        <runOrder>alphabetical</runOrder>
        <skipTests>${skipAllTests}</skipTests>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

但是在运行集成测试时,它们仍然没有按顺序运行。请注意,以“V”开头的文件首先以“G”开始...

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
Running org.mainco.subco.antivirus.queue.repo.VirusScanQueueDaoIT
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.196 sec - in org.mainco.subco.antivirus.queue.repo.VirusScanQueueDaoIT
Running org.mainco.subco.antivirus.queue.service.VirusScanQueueServiceIT
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.055 sec - in org.mainco.subco.antivirus.queue.service.VirusScanQueueServiceIT
Running org.mainco.subco.classroom.repo.GroupDaoIT
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.181 sec - in org.mainco.subco.classroom.repo.GroupDaoIT
Running org.mainco.subco.classroom.service.GroupServiceIT
Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.114 sec - in org.mainco.subco.classroom.service.GroupServiceIT
Running org.mainco.subco.core.repo.CategoryDaoIT

1 个答案:

答案 0 :(得分:1)

IT是按照班级fully qualified name的字母顺序运行的。以下列表

org.mainco.subco.antivirus.queue.repo.VirusScanQueueDaoIT
org.mainco.subco.antivirus.queue.service.VirusScanQueueServiceIT
org.mainco.subco.classroom.repo.GroupDaoIT
org.mainco.subco.classroom.service.GroupServiceIT
org.mainco.subco.core.repo.CategoryDaoIT

遵循此顺序。目前没有run orders只使用类名。