Jenkins:Spock 测试在 CentOS 中被跳过

Jenkins: Spock tests are being skipped in CentOS

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

我 运行 在 windows 中进行了相同的测试,没有问题。一切顺利。

更新: 这是 pom.xml:

<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>

更新:我的代码在这里

@Stepwise
@Requires({ jvm.isJava8() && os.windows} )
class HomePageTest extends GebReportingSpec
{
def "Open Homepage"()
{
    cleanReportGroupDir()
    when: "Opening browser"
    to TopPageTest;
    and:
    report "HomePageTest opened"

    then: "Click Login Button"
    loginButton.click()
    and:
    report "Login Button Clicked"
}

def "Enter credentials and log in to abc.co.jp"()
{
    when: "Log in page opened"
    at LoginPageTest
    and:
    report "Log in page opened"

    then: "Enter User Name and Password"
    username.value("name@abc.com")
    password.value("pass")
    and:
    signin.click()
    and:
    at TopPageTest
    report "Entered credentials and logged in"
}

def "Signin completed and top page opened. Now go to mypage"()
{
    when: "Signed in and top page is opened"
        myPage.click()

    then: "Waiting for loading mypage"  
        waitFor{at MyPageTest}
        report "MyPageTest opened"      
}

def "Click log Out button and log out from mypage"()
{
    when: "Logged into mypage"
        logout.click()

    then: "Waiting for loading mypage"
        waitFor{at BackToTopPageTest}
        report "Clicked logout button"      
}

def "After logged out , go back to homepage"()
{
    when: "Click \"Go To Top\" Button"
        goBackToTopPage.click()

    then: "Check if logged out"
        report "At homepage after logout"
}

}

问题出在您的 requires 过滤器:

@Stepwise
@Requires({ jvm.isJava8() && os.windows} )

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