Mahbub Rahman Mahbub Rahman - 3 months ago 12
Groovy Question

Jenkins: Spock tests are being skipped in CentOS

I am running maven test in Jenkins installed in virtual CentOS. But tests are being skipped. I don't understand the reason. Anyone solved the same issue?

I run the same test in windows and no issue. Everything going just fine.
enter image description here

UPDATE:
Here is the 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>


UPDATE: My code is here

@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"
}

}

Answer

The problem is your requires filter:

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

This will not run on CentOS, only on Windows.