maven入门-忽略未经过的单元测试
maven入门--忽略未通过的单元测试maven中提供了单元测试,以下是几个比较重要的配置或功能点1、pom.xml中设
maven入门--忽略未通过的单元测试
maven中提供了单元测试,以下是几个比较重要的配置或功能点
1、pom.xml中设置引入到jar包到scope为test(测试)写道
<project>
...
<dependencies>
...
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
...
</dependencies>
</project>
?
?
2、pom.xml中配置忽略掉test中的测试不通过(如果不忽略,则mvn install进行编译会不成功)
?
?写道<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
?
?
3、通过命令忽略编译一个工程时不通过的测试用例写道
mvn test -Dmaven.test.failure.ignore=true
?
?
4、编译工程时,跳过测试用例写道
mvn install -Dmaven.test.skip=true
?
?
5、在pom.xml中配置编译时跳过测试用例
?
?写道<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
?