maven项目如何跳过某些junit test,或者指定执行部分junit test

本文详细介绍了如何使用Maven Surefire插件来指定包含和排除的测试文件,通过具体的XML配置示例展示了如何精确控制哪些测试类被运行。

  maven-surefire-plugin的插件提供了对测试目录的配置,想要细看的或者学习更多东西的可以去http://maven.apache.org/surefire/maven-surefire-plugin学习.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.17</version>
  <configuration> <includes>   <include>**/Test1.java</include>   <include>**/Test2.java</include> </includes> <excludes> <exclude>**/Test3.java</exclude> <exclude>**/Test4.java</exclude> </excludes> </configuration>
</plugin>

  或者

<plugin>
  <groupId>org.apache.maven.plugins</groupId>  
  <artifactId>maven-surefire-plugin</artifactId>  
  <version>2.17</version>  
  <configuration>  
        <includes>
          <include>com/test/action/*Test.java</include>       
     </includes> <excludes> <exclude>com/test/action2/*Test.java</exclude> </excludes> </configuration> </plugin>

 

 

  

转载于:https://www.cnblogs.com/garfieldcgf/p/5486473.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值