jrock2004
jrock2004

Reputation: 3501

Groovy getting string errors

Trying to figure out this geb and spock testing framework and Having some problems. Right now I am just trying to work on getting spock to work.

@Grab(group='org.codehaus.geb', module='geb-core', version='0.7.2')
@Grab(group='org.seleniumhq.selenium', module='selenium-firefox-driver', version='2.31.0')
@Grab(group='org.spockframework', module='spock-core', version='0.6-groovy-1.7')
@Grab(group='org.codehaus.groovy', module='groovy-all', version='1.8.6')

import geb.*
import org.openqa.selenium.firefox.FirefoxDriver
import spock.lang.*


class TestSimpleGoogle extends Specification {
    def "pushing an element on the stack"() {
        when: "A variable is defined"
        title = "Hello"

        then: "Check to see if it equals hello"
        assert(title == "Hello")
    }
}

Here is the output I get from the command terminal

Caught: java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.InvokerHelper.getVersion()Ljava/lang/String;
java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.InvokerHelper.getVersion()Ljava/lang/String;
        at org.spockframework.util.GroovyReleaseInfo.getVersion(GroovyReleaseInfo.java:23)
        at org.spockframework.util.VersionChecker.<clinit>(VersionChecker.java:18)
        at org.spockframework.compiler.SpockTransform.<init>(SpockTransform.java:43)

Thoughts?

Upvotes: 0

Views: 1324

Answers (2)

Peter Niederwieser
Peter Niederwieser

Reputation: 123910

For Groovy 1.8 you'll need a Spock version that ends in groovy-1.8. To get started, the only grab you need is @Grab(group='org.spockframework', module='spock-core', version='0.7-groovy-1.8').

Upvotes: 1

tim_yates
tim_yates

Reputation: 171084

You're grabbing the wrong version of spock for the version of Groovy you're grabbing, and I'm not sure why you're grabbing groovy at all...

This works under Groovy 2.1.2:

@Grab( 'org.spockframework:spock-core:0.7-groovy-2.0' )
import spock.lang.*

class TestSimpleGoogle extends Specification {
  def "pushing an element on the stack"() {
    when: "A variable is defined"
      def title = "Hello"

    then: "Check to see if it equals hello"
      title == "Hello"
    }
}

Upvotes: 1

Related Questions