Jenkins:CentOS正在跳过Spock测试

时间:2016-08-15 02:58:32

标签: maven jenkins groovy spock geb

我正在安装在虚拟CentOS中的Jenkins中运行maven测试。但是正在跳过测试。我不明白原因。有人解决了同样的问题吗?

我在Windows中运行相同的测试,没有问题。一切都很顺利。 enter image description here

更新: 这是pom.xml:

class Task implements Runnable {
    private String id;
    private ConcurrentHashMap<String,String> logins;
    private Lock lock;

    public Task(String id, ConcurrentHashMap<String,String> logins, Lock lock) {
        this.id = id;
        this.logins = logins;
        this.lock = lock;
    }

    public void run() {
        login(id);
    }

    public void login(String id){
        lock.lock();

        String inserted = logins.putIfAbsent(id,id);

        if (inserted==null) {
            System.out.print("First login ");
            // other functions that require synchronization
            lock.unlock();
        } else {
            lock.unlock();
            // functions that do NOT require synchronization
            System.out.print("Second login ");
        }           
    }
}

更新:我的代码在这里

<project xmlns="http://maven.apache.org/POM/4.0.0"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0     http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
  <groupId>Geb</groupId>
  <artifactId>Geb</artifactId>
  <version>0.0.1-SNAPSHOT</version>
<properties>
    <gebVersion>0.13.1</gebVersion>
    <seleniumVersion>2.53.0</seleniumVersion>
    <groovyVersion>2.4.5</groovyVersion>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

<build>
<plugins>
    <groupId>org.codehaus.gmavenplus</groupId>
    <artifactId>gmavenplus-plugin</artifactId>
    <version>1.4</version>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
          <goal>testCompile</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>
</build>
<dependencies>
<dependency>
  <groupId>org.codehaus.groovy</groupId>
  <artifactId>groovy-all</artifactId>
  <version>${groovyVersion}</version>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.8.1</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.spockframework</groupId>
  <artifactId>spock-core</artifactId>
  <version>1.0-groovy-2.4</version>
  <scope>compile</scope>
  <exclusions>
    <exclusion>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.gebish</groupId>
  <artifactId>geb-spock</artifactId>
  <version>${gebVersion}</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.gebish</groupId>
  <artifactId>geb-core</artifactId>
  <version>0.13.1</version>
</dependency>
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-firefox-driver</artifactId>
  <version>${seleniumVersion}</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-support</artifactId>
  <version>${seleniumVersion}</version>
</dependency>
<dependency>
  <groupId>com.athaydes</groupId>
  <artifactId>spock-reports</artifactId>
  <version>1.2.12</version>
  <scope>test</scope>
  <!-- this avoids affecting your version of Groovy/Spock -->
  <exclusions>
    <exclusion>
      <groupId>*</groupId>
      <artifactId>*</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <version>1.6.4</version>
     </dependency>          
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <version>1.0.1</version>
     </dependency>          
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-core</artifactId>
       <version>1.0.1</version>
     </dependency>
</dependencies>  
</project>

1 个答案:

答案 0 :(得分:2)

问题在于您的<input>过滤器:

requires

这不会在CentOS上运行,只能在Windows上运行。