org.spockframework.runtime.InvalidSpecException

793 views
Skip to first unread message

St Clair Clarke

unread,
Mar 25, 2012, 9:38:21 PM3/25/12
to Spock Framework - User
Hello,
I am just investigating how Spock works. I am using Eclipse 4.2 M6 and
Groovy 1.8.x. I downloaded the spock-0.6-eclipse-1.8-core.jar file,
created wrap it to get an Eclipse plugin bundle jar an subsequently
place this jar on in my eclipse dropins directory.

My JDK is 1.7

My spock code resolves alright.

However, when I attempt to run it as a JUnit test I receive the
following stack trace:


org.spockframework.runtime.InvalidSpecException: Specification
'snippets.testing.test.spock.DataDriven' was not compiled
properly (Spock AST transform was not run); try to do a clean build
at org.spockframework.runtime.SpecUtil.checkIsSpec(SpecUtil.java:53)
at
org.spockframework.runtime.SpecInfoBuilder.buildSpec(SpecInfoBuilder.java:
75)
at
org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:
56)
at
org.spockframework.runtime.SpecInfoBuilder.build(SpecInfoBuilder.java:
42)
at org.spockframework.runtime.Sputnik.getSpec(Sputnik.java:78)
at
org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:
86)
at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55)
at org.junit.runner.Runner.testCount(Runner.java:38)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.countTestCases(JUnit4TestClassReference.java:
30)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.countTests(RemoteTestRunner.java:
487)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
455)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)

Questions:
1. What am I missing?
2. Why can't there be an Eclipse bundle jar that we download, simply
drop it in our eclipse dropins directory and be ready to go.
3. Is there any plans for an Eclipse update site soon?
4. Is Spock compatible with TestNg?

The semantics of Spock are impressive, but if I cannot get it to run -
well, I can't go any further.

Thanks

Peter Niederwieser

unread,
Mar 26, 2012, 12:24:18 AM3/26/12
to spockfr...@googlegroups.com
Spock is just a library that you place on your project's class path, not an Eclipse plugin. Due to its compatibility with JUnit, Spock tests can be run just like JUnit tests. Compatibility with TestNG isn't planned (and would benefit anyone). See http://code.google.com/p/spock/wiki/GettingStarted for how to get started with Spock and Eclipse. Regarding Eclipse 4.2, you'll have to check if the Groovy Eclipse plugin already supports that. Eclipse 3.7 is a safer bet.

Cheers,
Peter

> --
> You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
> To post to this group, send email to spockfr...@googlegroups.com.
> To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.
>

Howard Lewis Ship

unread,
Jun 11, 2012, 5:16:28 PM6/11/12
to spockfr...@googlegroups.com
I'm struggling with getting Spock to work as JUnit tests inside a
TestNG suite. I can't justify the effort to move 1300+ existing
TestNG tests to Spock, alas.

I'm getting an error ... I'll recreate my change and post the details shortly.
--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com
Reply all
Reply to author
Forward
0 new messages