首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Web自动化未在jenkins中运行

Web自动化未在jenkins中运行
EN

Stack Overflow用户
提问于 2014-07-24 18:00:24
回答 1查看 86关注 0票数 0

为什么我的jenkins工作没有执行我的Web测试。

Web测试是用JAVA selenium web驱动程序编写的,我也使用maven插件

我使用一些注释对我的测试进行分类。像这样的东西

代码语言:javascript
复制
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错误

代码语言:javascript
复制
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`

我哪里做错了,请帮帮忙?感谢预支

EN

回答 1

Stack Overflow用户

发布于 2014-07-24 18:17:49

首先,您应该根据Maven中的命名约定规则来命名测试,这意味着类似于WhatEverTest.java。如果您确实需要套件来定义测试,那么您应该使用maven-surefire-plugin的参数,而不是在documentation of maven-surefire-plugin中记录的代码中定义它。

代码语言:javascript
复制
<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测试是集成测试。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24930710

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档