I have set up Geb + Spock + Groovy and able to run a one sample script successfully. Now I have created one method in another groovy class (this class I have putted in resource folder) which I am calling in my test class but it giving me below error :
Unable to resolve FileHandling as content for Page, or as a property on its Navigator context. Is FileHandling a class you forgot to import?
"FileHandling" is name of my class which contains the method.I am able to run this method successfully as separate entity but when I am calling it in my test class and running it through pom.xml, I am getting above error.
Please let me know how this can be resolved. The code which is causing issue is below.
package test.groovy
import geb.spock.GebReportingSpec
import spock.lang.*
import FileHandling.*
@Stepwise
public class RateTest extends GebReportingSpec {
def "open application home page"() {
when:
go() // uses base url system property
def path_act = "C:/Users/abc.xlsx"
def cellArrayActual = FileHandling.returnExcelResults(path_act, "MEMBER_PREMIUM")
then:
title == "Welcome"
}
}
I feel the problem is not in code, something wrong in POM.xml dependencies, Please let me know what is wrong in it.
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Automation</groupId>
<artifactId>Automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.8</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.1.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-spock</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.7-groovy-2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.37.1</version>
</dependency>
</dependencies>