这是我正在使用的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 {
}
Test Suite可以单独运行。但是,当我使用eclipse运行maven-Install时,我想运行测试套件而不单独运行所有测试用例。但是它说
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ FinalProject ---
[INFO] Tests are skipped.
另外,我正在使用声纳检查线路覆盖范围,这也无法检测到我制作的testSuite。我是Junit TestSuite的新手,并且不知道如何使用Maven和声纳配置它们。
任何链接,参考或线索都将有所帮助。谢谢你。
确保在您的计算机中指定了JUnit依赖项 pom.xml
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
这是入门所需的唯一步骤-您现在可以在测试源目录中创建测试。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句