zoukankan      html  css  js  c++  java
  • [转]利用maven的surefire插件实现单元测试与集成测试

    原文链接
    http://my.oschina.net/dlpinghailinfeng/blog/301136

    maven单元测试与集成测试

    1. 通过maven的Profile
    2. 配置生命周期 通过maven-surefire-plugin的生命周期配置不同的测试范围

    如下使用的是方式2
    unit包中包含的是单元测试
    integration包种包含的是集成测试

    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                    <executions>
                        <execution>
                            <id>run-integration-test</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <includes>
                                    <include>**/integration/**/*.java</include>
                                </includes>
                            </configuration>
                        </execution>
                        <execution>
                            <id>run-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <includes>
                                    <include>**/unit/**/*.java</include>
                                </includes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.0</version>
                    <configuration>
                        <dependentWarExcludes>WEB-INF/lib</dependentWarExcludes>
                    </configuration>
                </plugin>
            </plugins>
    
  • 相关阅读:
    学习笔记
    核心网概要学习
    python基础知识
    python_基础知识_py运算符
    python_基础知识
    将博客搬至CSDN
    poj1182测试数据过了,但A不了,暂时放在这,以后再看
    score——3354
    杭电1241
    杭电1010(WA)
  • 原文地址:https://www.cnblogs.com/laoniu85/p/5128408.html
Copyright © 2011-2022 走看看