【发布时间】:2013-12-11 16:46:20
【问题描述】:
这是我正在使用的 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 和声纳配置它们。
任何链接、参考或线索都会有所帮助。 谢谢。
【问题讨论】:
-
删除
<skipTests>true</skipTests>这一行,否则测试将无法运行。 -
感谢您的回复,尽管它没有帮助,因为我希望 maven 运行 TestSuite 类并通过该类运行测试用例。但是,如果按照您的说法删除该行,所有测试用例都将由 maven 运行,这是不可取的。请告诉您是否清楚这个问题。谢谢
标签: unit-testing maven junit sonarqube test-suite