1.mavne的测试代码在src/main/test/中有junit注解等的程序
2.maven默认只会运行src/main/test/中的
**/(任何文件夹里的)
Test**
**Test
**TestCase
名字的java文件
3.想运行其他文件,可以加入插件,指定java文件名
1.找到maven的surefire插件
2.在pom中加入surefire插件
<!-- maven默认test时运行的java文件的扩展,加入此配置,会覆盖maven的默认值 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<!-- 包含的java文件名 -->
<includes>
<!-- Hellow开头的 -->
<include>Hellow*</include>
<include>Test*</include>
<include>*Test</include>
</includes>
<!-- 排除的java文件名 -->
<excludes>
<!-- Test开头的 -->
<exclude>Test*</exclude>
</excludes>
<!-- 是否跳过测试:true表示不会进行测试,不管运行什么命令,每个生命周期应该都有这个参数 -->
<skip>true</skip>
</configuration>
</plugin>