noob questions

21 views
Skip to first unread message

Bill Turner

unread,
Jul 4, 2009, 11:59:24 AM7/4/09
to Easyb Users
I just downloaded Easyb and unzipped the contents to d:\easyb. I then
installed the Intellij plug-in, adding d:\easyb to the Global
Libraries, and updated the file extensions. I then created a new
directory in my project called story, and created a story called
myStory.groovy (see code below). When I ran the story, I received a
MissingMethodException. So, I have several questions:

1) did I install properly?
2) what is the best practice for my story definitions. i am thinking
the dir I created, story, should probably exist under ./src/groovy.
Alternatively, it should be under ./test
3) why am i getting the error?
--
Here is my story definition.

import app.Message

given "given Message is initialized with blank detail", {
message = new Message(title:"My Message", detail:"")
}

when "validate is invoked on the message", {
value = message.validate()
}

then "the validator instance should return false", {
value.shouldBe false
}

--
Here is the console output

D:\jdk1.6.0_11\bin\java -Dgroovy.home=D:\easyb "-
Dgroovy.starter.conf=C:\Program Files\JetBrains\IntelliJ IDEA
9852\plugins\Groovy\lib\groovy-starter.conf" -Dtools.jar=D:
\jdk1.6.0_11\lib\tools.jar -Didea.launcher.port=7533 "-
Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA
9852\bin" -Dfile.encoding=windows-1252 -classpath "D:\jdk1.6.0_11\jre
\lib\charsets.jar;D:\jdk1.6.0_11\jre\lib\deploy.jar;D:\jdk1.6.0_11\jre
\lib\javaws.jar;D:\jdk1.6.0_11\jre\lib\jce.jar;D:\jdk1.6.0_11\jre\lib
\jsse.jar;D:\jdk1.6.0_11\jre\lib\management-agent.jar;D:
\jdk1.6.0_11\jre\lib\plugin.jar;D:\jdk1.6.0_11\jre\lib\resources.jar;D:
\jdk1.6.0_11\jre\lib\rt.jar;D:\jdk1.6.0_11\jre\lib\ext\dnsns.jar;D:
\jdk1.6.0_11\jre\lib\ext\localedata.jar;D:\jdk1.6.0_11\jre\lib\ext
\sunjce_provider.jar;D:\jdk1.6.0_11\jre\lib\ext\sunmscapi.jar;D:
\jdk1.6.0_11\jre\lib\ext\sunpkcs11.jar;D:\cygwin\home\Bill\teamwork\out
\production\teamwork;D:\grails-1.1\lib\jetty-util-6.1.14.jar;D:
\grails-1.1\lib\oscache-2.4.1.jar;D:\grails-1.1\lib\oro-2.0.8.jar;D:
\grails-1.1\lib\jasper-runtime-5.5.15.jar;D:\grails-1.1\lib\ant-
junit-1.7.0.jar;D:\grails-1.1\lib\spring-2.5.6.jar;D:\grails-1.1\lib
\ant-nodeps-1.7.0.jar;D:\grails-1.1\lib\ejb3-persistence-3.3.0.jar;D:
\grails-1.1\lib\org.springframework.webflow-2.0.3.RELEASE.jar;D:\easyb
\easyb-0.9.5.jar;D:\grails-1.1\lib\spring-webmvc-2.5.6.jar;D:
\grails-1.1\lib\jsp-api-2.1.jar;D:\grails-1.1\lib\commons-
collections-3.2.jar;D:\grails-1.1\lib\backport-util-
concurrent-3.0.jar;D:\grails-1.1\lib\serializer.jar;D:\grails-1.1\lib
\commons-beanutils-1.7.0.jar;D:\grails-1.1\lib\sitemesh-2.4.jar;D:
\grails-1.1\dist\grails-crud-1.1.jar;D:\grails-1.1\lib\slf4j-
api-1.5.6.jar;D:\grails-1.1\lib\jstl-2.3.jar;D:\grails-1.1\lib
\jsr107cache-1.0.jar;D:\grails-1.1\dist\grails-spring-1.1.jar;D:
\grails-1.1\lib\start.jar;D:\grails-1.1\lib\jetty-plus-6.1.14.jar;D:
\grails-1.1\lib\jasper-compiler-5.5.15.jar;D:\grails-1.1\lib\commons-
lang-2.4.jar;D:\grails-1.1\dist\grails-webflow-1.1.jar;D:
\grails-1.1\lib\commons-fileupload-1.1.1.jar;D:\grails-1.1\lib\ant-
trax.jar;D:\grails-1.1\lib\cglib-nodep-2.1_3.jar;D:\grails-1.1\lib
\slf4j-log4j12-1.5.6.jar;D:\grails-1.1\dist\grails-resources-1.1.jar;D:
\grails-1.1\lib\ehcache-1.5.0.jar;D:\grails-1.1\lib\groovy-
all-1.6.0.jar;D:\grails-1.1\lib\hsqldb-1.8.0.5.jar;D:\grails-1.1\lib
\jline-0.9.91.jar;D:\grails-1.1\dist\grails-test-1.1.jar;D:
\grails-1.1\lib\antlr-2.7.6.jar;D:\grails-1.1\lib\ognl-2.6.9.jar;D:
\easyb\commons-cli-1.1.jar;D:\grails-1.1\lib\ant-1.7.0.jar;D:
\grails-1.1\lib\ivy-2.0.0.jar;D:\easyb\groovy-1.6.0.jar;D:
\grails-1.1\lib\standard-2.3.jar;D:\grails-1.1\lib
\org.springframework.binding-2.0.3.RELEASE.jar;D:\grails-1.1\lib\jsp-
api-2.0.jar;D:\grails-1.1\lib\commons-cli-1.0.jar;D:\grails-1.1\dist
\grails-gorm-1.1.jar;D:\grails-1.1\dist\grails-core-1.1.jar;D:
\grails-1.1\lib\standard-2.4.jar;D:\grails-1.1\lib\commons-
dbcp-1.2.1.jar;D:\grails-1.1\lib\ant-launcher-1.7.0.jar;D:
\grails-1.1\lib\commons-pool-1.2.jar;D:\grails-1.1\lib\spring-
test-2.5.6.jar;D:\grails-1.1\lib\jetty-naming-6.1.14.jar;D:
\grails-1.1\lib\jetty-6.1.14.jar;D:\grails-1.1\dist\grails-
bootstrap-1.1.jar;D:\grails-1.1\lib\jta-1.1.jar;D:\grails-1.1\lib
\jasper-compiler-jdt-5.5.15.jar;D:\grails-1.1\lib
\org.springframework.js-2.0.3.RELEASE.jar;D:\grails-1.1\lib\jcl-over-
slf4j-1.5.6.jar;D:\grails-1.1\lib\commons-validator-1.3.0.jar;D:
\grails-1.1\lib\commons-io-1.4.jar;D:\grails-1.1\lib\commons-
codec-1.3.jar;D:\grails-1.1\lib\svnkit-1.2.0.jar;D:\grails-1.1\lib
\xpp3_min-1.1.3.4.O.jar;D:\grails-1.1\dist\grails-web-1.1.jar;D:
\grails-1.1\lib\commons-el-1.0.jar;D:\easyb;D:\grails-1.1\lib
\log4j-1.2.15.jar;D:\grails-1.1\lib\servlet-api-2.5-6.1.14.jar;D:
\grails-1.1\lib\junit-3.8.2.jar;D:\grails-1.1\lib\jstl-2.4.jar;D:
\grails-1.1\lib\gant_groovy1.6-1.6.0.jar;D:\grails-1.1\dist\grails-
scripts-1.1.jar;C:\Documents and Settings\Bill\.grails\1.1\projects
\teamwork\plugins\hibernate-1.1\lib\javassist-3.4.GA.jar;D:\cygwin\home
\Bill\teamwork\lib;C:\Documents and Settings\Bill\.grails\1.1\projects
\teamwork\plugins\hibernate-1.1\lib\hibernate3-3.3.1.jar;C:\Documents
and Settings\Bill\.grails\1.1\projects\teamwork\plugins
\hibernate-1.1\lib\hibernate-annotations-3.3.0.jar;C:\Documents and
Settings\Bill\.grails\1.1\projects\teamwork\plugins\hibernate-1.1\lib
\hibernate-commons-annotations-3.3.0.jar;C:\Documents and Settings\Bill
\.grails\1.1\projects\teamwork\plugins\hibernate-1.1\lib;C:\Documents
and Settings\Bill\.grails\1.1\projects\teamwork\plugins
\hibernate-1.1\lib\dom4j-1.6.1.jar;C:\Program Files\JetBrains\IntelliJ
IDEA 9852\lib\idea_rt.jar"
com.intellij.rt.execution.application.AppMain
org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --
conf "C:\Program Files\JetBrains\IntelliJ IDEA 9852\plugins\Groovy\lib
\groovy-starter.conf" --classpath "D:\cygwin\home\Bill\teamwork\out
\production\teamwork;D:\grails-1.1\lib\jetty-util-6.1.14.jar;D:
\grails-1.1\lib\oscache-2.4.1.jar;D:\grails-1.1\lib\oro-2.0.8.jar;D:
\grails-1.1\lib\jasper-runtime-5.5.15.jar;D:\grails-1.1\lib\ant-
junit-1.7.0.jar;D:\grails-1.1\lib\spring-2.5.6.jar;D:\grails-1.1\lib
\ant-nodeps-1.7.0.jar;D:\grails-1.1\lib\ejb3-persistence-3.3.0.jar;D:
\grails-1.1\lib\org.springframework.webflow-2.0.3.RELEASE.jar;D:\easyb
\easyb-0.9.5.jar;D:\grails-1.1\lib\spring-webmvc-2.5.6.jar;D:
\grails-1.1\lib\jsp-api-2.1.jar;D:\grails-1.1\lib\commons-
collections-3.2.jar;D:\grails-1.1\lib\backport-util-
concurrent-3.0.jar;D:\grails-1.1\lib\serializer.jar;D:\grails-1.1\lib
\commons-beanutils-1.7.0.jar;D:\grails-1.1\lib\sitemesh-2.4.jar;D:
\grails-1.1\dist\grails-crud-1.1.jar;D:\grails-1.1\lib\slf4j-
api-1.5.6.jar;D:\grails-1.1\lib\jstl-2.3.jar;D:\grails-1.1\lib
\jsr107cache-1.0.jar;D:\grails-1.1\dist\grails-spring-1.1.jar;D:
\grails-1.1\lib\start.jar;D:\grails-1.1\lib\jetty-plus-6.1.14.jar;D:
\grails-1.1\lib\jasper-compiler-5.5.15.jar;D:\grails-1.1\lib\commons-
lang-2.4.jar;D:\grails-1.1\dist\grails-webflow-1.1.jar;D:
\grails-1.1\lib\commons-fileupload-1.1.1.jar;D:\grails-1.1\lib\ant-
trax.jar;D:\grails-1.1\lib\cglib-nodep-2.1_3.jar;D:\grails-1.1\lib
\slf4j-log4j12-1.5.6.jar;D:\grails-1.1\dist\grails-resources-1.1.jar;D:
\grails-1.1\lib\ehcache-1.5.0.jar;D:\grails-1.1\lib\groovy-
all-1.6.0.jar;D:\grails-1.1\lib\hsqldb-1.8.0.5.jar;D:\grails-1.1\lib
\jline-0.9.91.jar;D:\grails-1.1\dist\grails-test-1.1.jar;D:
\grails-1.1\lib\antlr-2.7.6.jar;D:\grails-1.1\lib\ognl-2.6.9.jar;D:
\easyb\commons-cli-1.1.jar;D:\grails-1.1\lib\ant-1.7.0.jar;D:
\grails-1.1\lib\ivy-2.0.0.jar;D:\easyb\groovy-1.6.0.jar;D:
\grails-1.1\lib\standard-2.3.jar;D:\grails-1.1\lib
\org.springframework.binding-2.0.3.RELEASE.jar;D:\grails-1.1\lib\jsp-
api-2.0.jar;D:\grails-1.1\lib\commons-cli-1.0.jar;D:\grails-1.1\dist
\grails-gorm-1.1.jar;D:\grails-1.1\dist\grails-core-1.1.jar;D:
\grails-1.1\lib\standard-2.4.jar;D:\grails-1.1\lib\commons-
dbcp-1.2.1.jar;D:\grails-1.1\lib\ant-launcher-1.7.0.jar;D:
\grails-1.1\lib\commons-pool-1.2.jar;D:\grails-1.1\lib\spring-
test-2.5.6.jar;D:\grails-1.1\lib\jetty-naming-6.1.14.jar;D:
\grails-1.1\lib\jetty-6.1.14.jar;D:\grails-1.1\dist\grails-
bootstrap-1.1.jar;D:\grails-1.1\lib\jta-1.1.jar;D:\grails-1.1\lib
\jasper-compiler-jdt-5.5.15.jar;D:\grails-1.1\lib
\org.springframework.js-2.0.3.RELEASE.jar;D:\grails-1.1\lib\jcl-over-
slf4j-1.5.6.jar;D:\grails-1.1\lib\commons-validator-1.3.0.jar;D:
\grails-1.1\lib\commons-io-1.4.jar;D:\grails-1.1\lib\commons-
codec-1.3.jar;D:\grails-1.1\lib\svnkit-1.2.0.jar;D:\grails-1.1\lib
\xpp3_min-1.1.3.4.O.jar;D:\grails-1.1\dist\grails-web-1.1.jar;D:
\grails-1.1\lib\commons-el-1.0.jar;D:\easyb;D:\grails-1.1\lib
\log4j-1.2.15.jar;D:\grails-1.1\lib\servlet-api-2.5-6.1.14.jar;D:
\grails-1.1\lib\junit-3.8.2.jar;D:\grails-1.1\lib\jstl-2.4.jar;D:
\grails-1.1\lib\gant_groovy1.6-1.6.0.jar;D:\grails-1.1\dist\grails-
scripts-1.1.jar;C:\Documents and Settings\Bill\.grails\1.1\projects
\teamwork\plugins\hibernate-1.1\lib\javassist-3.4.GA.jar;D:\cygwin\home
\Bill\teamwork\lib;C:\Documents and Settings\Bill\.grails\1.1\projects
\teamwork\plugins\hibernate-1.1\lib\hibernate3-3.3.1.jar;C:\Documents
and Settings\Bill\.grails\1.1\projects\teamwork\plugins
\hibernate-1.1\lib\hibernate-annotations-3.3.0.jar;C:\Documents and
Settings\Bill\.grails\1.1\projects\teamwork\plugins\hibernate-1.1\lib
\hibernate-commons-annotations-3.3.0.jar;C:\Documents and Settings\Bill
\.grails\1.1\projects\teamwork\plugins\hibernate-1.1\lib;C:\Documents
and Settings\Bill\.grails\1.1\projects\teamwork\plugins
\hibernate-1.1\lib\dom4j-1.6.1.jar;" D:/cygwin/home/Bill/teamwork/
story/myStory.groovy
Caught: groovy.lang.MissingMethodException: No signature of method:
myStory.given() is applicable for argument types: (java.lang.String,
myStory$_run_closure1) values: [given Message is initialized with a
blank message, myStory$_run_closure1@2c35e]
at myStory.run(myStory.groovy:3)

--
Here is the Message class (a Grails domain class)

package app

class Message {
String title
String detail
Date dateCreated
Date lastUpdated

static constraints = {
title(blank:false, size:1..50)
detail(blank:false)
dateCreated()
lastUpdated()
}
}


--

Your help is appreciated!

Richard Vowles

unread,
Jul 4, 2009, 4:50:37 PM7/4/09
to easyb...@googlegroups.com
Hi Bill,

I'm sorry I don't use the IntelliJ plugin, but this is not using easyb to run your test. It is treating it as a normal Groovy file and thus, missing the given method :-( There must be some mechanism by which you can run your MyStory.groovy file under easyb from the intellijj plugin?

Richard

On Sun, Jul 5, 2009 at 3:59 AM, Bill Turner <worldwi...@gmail.com> wrote:

I just downloaded Easyb and unzipped the contents to d:\easyb. I then
installed the Intellij plug-in, adding d:\easyb to the Global
Libraries, and updated the file extensions. I then created a new
directory in my project called story, and created a story called
myStory.groovy (see code below). When I ran the story, I received a
MissingMethodException. So, I have several questions:
...

and Settings\Bill\.grails\1.1\projects\teamwork\plugins
\hibernate-1.1\lib\dom4j-1.6.1.jar;" D:/cygwin/home/Bill/teamwork/
story/myStory.groovy
Caught: groovy.lang.MissingMethodException: No signature of method:
myStory.given() is applicable for argument types: (java.lang.String,
myStory$_run_closure1) values: [given Message is initialized with a
blank message, myStory$_run_closure1@2c35e]
       at myStory.run(myStory.groovy:3)



--
---
Richard Vowles,
Talk to me about development in Grails, Groovy, Java and for the Blackberry
ph: +64275467747, linkedin, skype:rvowles
get 2Gb shared disk space in the cloud - Dropbox, its incredibly useful! - http://tinyurl.com/cmcceh
podcast: http://www.illegalargument.com

Andrew Glover

unread,
Jul 5, 2009, 8:42:19 PM7/5/09
to easyb...@googlegroups.com
yeah, it appears your story is being run by Groovy instead of easyb -- the plug-in doesn't require you add easyb to any global libraries -- just right click on your story (it always helps to name it .story as that's an obvious hint to the plug-in) and you should have an option to run as easyb specification....
--
Sincerely,

Andrew Glover
703.577.0830 (cell)

Bill Turner

unread,
Jul 6, 2009, 10:40:15 AM7/6/09
to Easyb Users
I added the easb dir to the global libraries based upon the statement
"NOTE Also, with the current version of the plugin you will need to
make easyb available on the classpath of your project. The next
release of the plugin will make this unnecessary." on this page:
http://www.easyb.org/running.html#intellij. Being a noob to Intellij
as well, perhaps this was incorrect. So, I removed that. I also
renamed the story to Message.story and placed it in a directory called
story under the ./test dir. Now, when I start it, it appears to start
well, but then things fall apart. I have a window that appears to be
some sort of progress window that shows:

Story Message
+- Given given Message is initialized with blank detail
+- When validate is invoked on the message

And the console window shows a stack trace, java.net.SocketException:
Software caused connection abort: socket write error. Does this
indicate an error with my Then statement, then the validator instance
should return false? Am I missing something in my configuration? Or,
have I done something wrong syntactically? This seems like a very
simple test, one I wrote just to get started with easyb, so I am
inclined to believe it is not a syntax problem, yet experience tells
me that it is likely to be such. :-(


On Jul 5, 7:42 pm, Andrew Glover <ajglo...@gmail.com> wrote:
> yeah, it appears your story is being run by Groovy instead of easyb -- the
> plug-in doesn't require you add easyb to any global libraries -- just right
> click on your story (it always helps to name it .story as that's an obvious
> hint to the plug-in) and you should have an option to run as easyb
> specification....
>
> On Sat, Jul 4, 2009 at 4:50 PM, Richard Vowles <richard.vow...@gmail.com>wrote:
>
>
>
> > Hi Bill,
>
> > I'm sorry I don't use the IntelliJ plugin, but this is not using easyb to
> > run your test. It is treating it as a normal Groovy file and thus, missing
> > the given method :-( There must be some mechanism by which you can run your
> > MyStory.groovy file under easyb from the intellijj plugin?
>
> > Richard
>

Andrew Glover

unread,
Jul 6, 2009, 12:01:05 PM7/6/09
to easyb...@googlegroups.com
Bill -- could you send along the story you are trying to execute? Also, it appears the plug-in isn't working correctly in the newer versions of IntelliJ (on the 9. branch).

Bill Turner

unread,
Jul 6, 2009, 3:12:15 PM7/6/09
to Easyb Users
Supposedly, according the about, I am running 8.1.3 build 9886.

Here is my code:

import app.Message

given "given Message is initialized with blank detail", {
message = new Message(title:"My Message", detail:"")
}

when "validate is invoked on the message", {
value = message.validate()
}

then "the validator instance should return false", {
value.shouldBe false
}


On Jul 6, 11:01 am, Andrew Glover <ajglo...@gmail.com> wrote:
> Bill -- could you send along the story you are trying to execute? Also, it
> appears the plug-in isn't working correctly in the newer versions of
> IntelliJ (on the 9. branch).
>

Bill Turner

unread,
Jul 6, 2009, 3:32:37 PM7/6/09
to Easyb Users
I am thinking that the problem here is that I am calling validate on a
grails domain class in unit test, therefore whatever needs to be
injected to allow validate or save to execute has not been injected.
Is this an accurate assumption? If so, what do you happen to know what
I need to do?

Richard Vowles

unread,
Jul 6, 2009, 4:57:23 PM7/6/09
to easyb...@googlegroups.com
That would most definitely be true. As of Grails 1.1, there was a mocking framework created to allow for unit testing of Grails applications. This isn't available in easyb because you don't descend from GrailsUnitTest (or any of its children). Thats what the grails/easyb plugin tries to solve and I can't see it working via the intellij idea plugin...

Personally I would have expected you to be doing domain testing using Specifications rather than Stories...


On Tue, Jul 7, 2009 at 7:32 AM, Bill Turner <worldwi...@gmail.com> wrote:

I am thinking that the problem here is that I am calling validate on a
grails domain class in unit test, therefore whatever needs to be
injected to allow validate or save to execute has not been injected.
Is this an accurate assumption? If so, what do you happen to know what
I need to do?


Bill Turner

unread,
Jul 6, 2009, 6:03:02 PM7/6/09
to Easyb Users
I'm not really using it to test the app. I am just trying to learn how
to use easyb.

Have I inferred correctly that if I were to write a spec instead, the
domain could be tested?

On Jul 6, 3:57 pm, Richard Vowles <richard.vow...@gmail.com> wrote:
> That would most definitely be true. As of Grails 1.1, there was a mocking
> framework created to allow for unit testing of Grails applications. This
> isn't available in easyb because you don't descend from GrailsUnitTest (or
> any of its children). Thats what the grails/easyb plugin tries to solve and
> I can't see it working via the intellij idea plugin...
>
> Personally I would have expected you to be doing domain testing using
> Specifications rather than Stories...
>

Richard Vowles

unread,
Jul 6, 2009, 6:16:31 PM7/6/09
to easyb...@googlegroups.com
Sorry - no. I am coming from the guidelines from The RSpec Book, which says - test APIs with Specifications (as they are more like unit tests) and UI (e.g. controllers) with stories. I like their method of doing things...

You still can't test the domain unless you mock the living daylights out of it sorry :-)

If you are determined to do this - add in a line like:

def testCase = new GrailsUnitTestCase()

and when you want to mock your objects - testCase.mockDomain( Message.class, [] )

and then do what you want. The alternative to make it even nicer, could be to add the mocking methods to the current script.

Richard


On Tue, Jul 7, 2009 at 10:03 AM, Bill Turner <worldwi...@gmail.com> wrote:

I'm not really using it to test the app. I am just trying to learn how
to use easyb.

Have I inferred correctly that if I were to write a spec instead, the
domain could be tested?



--
---
Richard Vowles,
Talk to me about development in Grails, Groovy, Java and for the Blackberry
ph: +64275467747, linkedin, skype:rvowles

Bill Turner

unread,
Jul 6, 2009, 6:40:00 PM7/6/09
to Easyb Users
I guess I am not that determined. hahahaha! Good to know, however.
I'll find some other class to fool with, perhaps something java.

On Jul 6, 5:16 pm, Richard Vowles <richard.vow...@gmail.com> wrote:
> Sorry - no. I am coming from the guidelines from The RSpec Book, which says
> - test APIs with Specifications (as they are more like unit tests) and UI
> (e.g. controllers) with stories. I like their method of doing things...
>
> You still can't test the domain unless you mock the living daylights out of
> it sorry :-)
>
> If you are determined to do this - add in a line like:
>
> def testCase = new GrailsUnitTestCase()
>
> and when you want to mock your objects - testCase.mockDomain( Message.class,
> [] )
>
> and then do what you want. The alternative to make it even nicer, could be
> to add the mocking methods to the current script.
>
> Richard
>
> On Tue, Jul 7, 2009 at 10:03 AM, Bill Turner <worldwidewi...@gmail.com>wrote:
>
>
>
> > I'm not really using it to test the app. I am just trying to learn how
> > to use easyb.
>
> > Have I inferred correctly that if I were to write a spec instead, the
> > domain could be tested?
>
> --
> ---
> Richard Vowles,
> Talk to me about development in Grails, Groovy, Java and for the Blackberry
> ph: +64275467747, linkedin, skype:rvowles
Reply all
Reply to author
Forward
0 new messages