I am trying to use Geb+Spock to do web automation testing, but it keeps telling me :
Caught: java.lang.NoClassDefFoundError: spock/lang/Specification
Caused by: java.lang.ClassNotFoundException: spock.lang.Specification
And I think I have already added the things spock might need ...?
@Grapes([
@Grab('org.gebish:geb-core:1.1.1'),
@Grab('org.seleniumhq.selenium:selenium-chrome-driver:2.42.0'),
@Grab('org.seleniumhq.selenium:selenium-support:2.42.0'),
@Grab('org.gebish:geb-spock:1.1.1')
])
import geb.spock.GebSpec
import spock.lang.*
class GoogleSpec extends GebSpec{
def "Google search"() {
given:
to GooglePage
when:
searchBox.value == "Dogs"
and:
searchButton.click()
then:
at ResultPage
}
}
Well, maybe you also want to add dependencies to
org.spockframework:spock-core:1.0-groovy-2.4
cglib:cglib-nodep:3.2.4
org.objenesis:objenesis:2.2
I don't know anything about Gradle, but those I use in Maven.
P.S.: Maybe next time you want to use your favourite web search engine to look for sample projects or documentation first. You should find plenty.