如何使用Maven surefire顺序运行测试

时间:2017-05-09 08:37:38

标签: maven unit-testing jenkins junit maven-surefire-plugin

在互联网上到处搜索后,我在这里发布我的问题以获得可能的答案。首先,抱歉我的英语不好,我是法国人。

我正在尝试在Jenkins中运行Java测试以进行持续集成项目。但Maven并行运行测试。前10个测试需要按顺序运行,因为它们初始化数据库和一些模板。

我在官方网页上找到了此链接:https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html 但当我在我的Java测试类上使用@NotThreadSafe时,他们说我得到了一个错误:

  

错误:找不到符号

     

无法解析错误消息:symbol:class NotThreadSafe

我使用Maven 2.2.1,Junit 4.6

你知道我该怎么办?

编辑:我的pom.xml

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
            <includes>
                <include>**/P99ReleaseTestSuite.java</include>
            </includes>
            <!--
                <excludes> <exclude>**/*Test.java</exclude> </excludes>
            -->
            <skipExec>${surefire.tests.execution.skip}</skipExec>
            <testFailureIgnore>${surefire.tests.execution.ignore-error}</testFailureIgnore>
            <forkMode>once</forkMode>
            <argLine>-Xms512m -Xmx2048m</argLine>
        </configuration>
    </plugin>

我在linux服务器上运行这些测试。在Windows上,在我的日食中,所有测试都按顺序运行

0 个答案:

没有答案