这是我使用的maven surefire插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>runner.TestSuite.java</include>
</includes>
<skipTests>true</skipTests>
</configuration>
</plugin>
这是testSuite类
package runner;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import action.TestLogin;
import action.TestRegister;
@RunWith(Suite.class)
@Suite.SuiteClasses({ TestRegister.class, TestLogin.class })
public class TestSuite {
}
测试套件单独运行很好。但是,当我使用eclipse运行mavenInstall时,我希望在不单独运行所有测试用例的情况下运行测试套件。但上面写着
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ FinalProject ---
[INFO] Tests are skipped.
此外,我正在使用声纳检查线路覆盖范围,这也无法检测到我制作的testSuite。我是Junit TestSuite&不知道如何用maven&声纳。
任何链接、参考或线索都会有所帮助。非常感谢。
确保在pom.xml
中指定了JUnit依赖项
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
这是开始所需的唯一步骤——您现在可以在测试源目录中创建测试。
更多关于此的信息,请访问Maven Surefire插件