为什么我的jenkins工作没有执行我的Web测试。
Web测试是用JAVA selenium web驱动程序编写的,我也使用maven插件
我使用一些注释对我的测试进行分类。像这样的东西
public interface FastTests {
}
public interface SlowTests {
}
public static class A {
@Test
public void a() {
fail();
}
@Category(SlowTests.class)
@Test
public void b() {
}
}
@Category( { SlowTests.class, FastTests.class })
public static class B {
@Test
public void c() {
}
}
@RunWith(Categories.class)
@IncludeCategory(SlowTests.class)
@SuiteClasses( { A.class, B.class })
// Note that Categories is a kind of Suite
public static class SlowTestSuite {
}JENKINS错误
09:36:32 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project mpqa-webloader: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
09:36:32 [JENKINS] Archiving C:\Jenkins\workspace\WebAutomationWindows\web\pom.xml to com.mpayme.testkit/mpqa-webloader/0.0.1-SNAPSHOT/mpqa-webloader-0.0.1-SNAPSHOT.pom
09:36:32 [ERROR]
09:36:32 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
09:36:32 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
09:36:32 [ERROR]
09:36:32 [ERROR] For more information about the errors and possible solutions, please read the following articles:
09:36:32 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException`我哪里做错了,请帮帮忙?感谢预支
发布于 2014-07-24 18:17:49
首先,您应该根据Maven中的命名约定规则来命名测试,这意味着类似于WhatEverTest.java。如果您确实需要套件来定义测试,那么您应该使用maven-surefire-plugin的参数,而不是在documentation of maven-surefire-plugin中记录的代码中定义它。
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<groups>com.example.FastTests,com.example.RegressionTests</groups>
</configuration>
</plugin>
</plugins>
</build>除此之外,听起来你需要将单元测试和集成测试分开,因为像慢测试这样的事情听起来像是集成测试,应该由maven-failsafe-plugin来处理。特别是,如果我们讨论的是selenium测试,根据定义,selenium测试是集成测试。
https://stackoverflow.com/questions/24930710
复制相似问题