Hi Howard, take a look at http://spockframework.org/ a really interesting groovy test framework
I know that one of the commiters is using it heavily to test Tapestry IOC services and Tapestry 5 pages. using groovy to verify generated html is much more fun. g, kris Von: Christian Edward Gruber <[email protected]> An: "Tapestry development" <[email protected]> Datum: 20.05.2010 01:41 Betreff: Re: Groovy for tests? I think you can nicely end up with a good test-oriented DSL by using Groovy, which should make tests nice and readable. Christian. On May 19, 2010, at 7:32 PM, Howard Lewis Ship wrote: > Absolutely. This is just for some new tests I'm writing; I'm not > talking about a wholesale change. I'm already pretty pleased with > some of the results. > > > void execute(root, resolver, closure) { > > replay() > > closure.call(new PageTemplateLocator(root, resolver)) > > verify() > } > > @Test > void not_a_page_class() { > def model = mockComponentModel() > def root = mockResource() > def resolver = mockComponentClassResolver() > > train_getComponentClassName(model, "foo.bar.Baz") > > execute (root, resolver) { > > assert it.locateTemplate (model, Locale.FRENCH) == null > } > } > > Using a method + closure to instantiate the object being tested and > pass it as "it" to the closure works really well (and eliminates > confusion about replay() and verify() ). > > I'm sure my Groovy skills will improve and there'll be better ways to > do this, but not having to deal with all the variable types is already > a step in the right direction. > > On Wed, May 19, 2010 at 1:13 PM, Igor Drobiazko > <[email protected]> wrote: >> I guess you don't want to force all Tapestry users to switch to >> Groovy-based >> tests. It should be still possible to write pure java tests after the >> upgrade to 5.2. Furthermore existing test should still work. >> >> However, I need a reason to improve my Groovy skills. :) So go ahead. >> >> On Wed, May 19, 2010 at 5:16 PM, Howard Lewis Ship >> <[email protected]> wrote: >> >>> I'd like to start experimenting with writing some of the Tapestry >>> tests in Groovy, rather than Java. Any objections? >>> >>> -- >>> 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 >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> >> -- >> Best regards, >> >> Igor Drobiazko >> http://tapestry5.de/blog >> > > > > -- > 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 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
