Wednesday, June 8, 2011

Grails testing improvements

Peter Ledbrook put up a new blog post detailing some of the improvements to come 1.4 for unit testing grails: http://blog.springsource.com/2011/06/07/countdown-to-grails-1-4-unit-testing/

There's some awesome stuff in there. I had read a bit about the new features in milestone 1. But it didn't show the kind of details that Peter has. I'm especially excited about these two features:
  1. Full Gorm testing. It looks like they're using some kind of noSQL database in-memory. I'm interested to see if it will slow down the unit test at all, but the method of testing is much more intuitive. The whole mockDomain(Class,listOfInstances) felt a bit dirty, and it was kind of brittle if you used any kind of inheritance at all.
  2. Improved JSON response testing. Grails now does the work in the mock response of converting the JSON response to a proper object hierarchy. In my own testing, I could get halfway there by converting the responseText to JSONObjects, but they were a bit painful to work with at times. (especially arrays)
Those two fixes represent for me the only real issues I have with grails unit testing. The annotations are nice, but I had given up on the test hierarchy long ago. You can use MockUtils easily in the same way that GrailsUnitTest does.

That leaves only one major complaint for me regarding testing and Grails: Integration testing. Its nice that they found ways to allow for using unit testing more often, but it doesn't solve the fundamental problem. Integration testing takes too long because you have to start the world. Lately I've been working a lot with ElasticSearch, and I refused to put it in the Integration test folder and rely on the bootstrap. In the test setup I brought up an in-memory ElasticSearch instance and test against it. Its definitely an integration test, but I can run it in about 6 seconds. It takes longer than that for Grails to resolve dependencies. (Which is something I hear they're addressing in 1.4) Its all perfectly fine for CI, but you can't use it to test on the fly. Its far too tempting to do a run-war and fiddle with it that way. It seems like it wouldn't be too difficult to bring up a persistent integration testing environment. In truth, it would probably still be some kind of headless container that you could keep running integration tests in without having to restart the container. I've seen a few other Grails bloggers mention it though, so perhaps its on the roadmap somewhere? Maybe post 1.4?

30 comments:

Graeme Rocher said...

For speeding up integration testing we recommend using interactive mode which is greatly improved in 1.4. In 1.3.x you can do:

{code}
grails interactive
{code}

Then type test-app, but it has a few issues which we're addressing in 1.4

Lucas Ward said...

Graeme,

I've tried that once or twice before and its still was too slow to run it reliably. I know one issue you're addressing is dependency resolution, but what are the other issues to speed it up in interactive mode in 1.4?

I still kind of wish I could start an integration environment in something like Jetty with an overlay, and just runs tets, which perhaps under the covers are either JMX or 'web service' calls to run tests in the container and report back results.

steve7876 said...

Mobile marketing works with ads formats, customization of ads and styles that can vary as many social media platforms, websites like passbeemedia and different mobile apps like passbook offer their own unique mobile ad options. How apple pay works with passbook?

steve7876 said...

I am much excited for you testing success . Best of luck for future Brian Mercado

shahbaz said...

Sanction you to present expertise take assay, creating, likewise moreover problems controlling, adjacent engage them to boost sites about my foremosts’ honorable about gross acquiesce spirit is typically essential.perumahan batununggal bandung

steve7876 said...

Several things should be checked before a long driving. It is only for the safe driving. All the basic problems of a vehicle, like: break problems,Escape The Room

steve7876 said...

Every recipe of yours I have tried have been a big hit with my family. I am certain this one will be, too. I love your blog and can’t wait to see what you post next.ems korea

steve7876 said...

I was always in search of such useful information you have shared in this blog. This will help me in my working.halong tours

steve7876 said...

Time sitting in silence, finding stillness within and creating an atmosphere of loving kindness.Escape Room

purv said...

Sanction you to present expertise take assay, creating, likewise moreover problems controlling, adjacent engage them to boost sites about my foremosts’ honorable about gross acquiesce spirit is typically essential Christmas Wishes
Happy Valentine's Day 2016
Valentine Week 2016

rahhul said...

happyhugday.com
www.happyhugday.com
happy hug day
happy hug day images
happy hug day quotes
happy hug day pics
happy hug day wallpaper
happy hug day messages
happy hug day wallpapers
happy hug day photo
happy hug day sms
happy hug day pictures
happy hug day 2016
happy hug day photos
happy hug day for friends
happy hug day date
happy hug day msg
hug day special sms
happy hug day shayari
happy hug day picture
happy hug day wishes
sms for hug day
sms on hug day
hug day sms love
valentine hug day sms
best hug day sms

Valentines Day Quotes said...

happy Valentines Day 2016
Valentines Day 2016 Quotes
valentines day 2016 images
Happy Valentines Day 2016 Romantic Quotes
valentines day 2016 sms
Valentines Day Messages 2016 For Whats App

rahhul said...

http://republicdayquotes2016.com
http://republicdayquotes2016.com/happy-26th-january-republic-day-pictures/
http://republicdayquotes2016.com/indian-flag-pictures-images-for-republic-day-2016/
http://republicdayquotes2016.com/happy-republic-day-2016-sms-wishes/
http://republicdayquotes2016.com/happy-republic-day-quotes-in-hindi/
http://republicdayquotes2016.com/why-is-republic-day-celebrated-in-india-on-26th-january/
http://republicdayquotes2016.com/happy-republic-day-2016-quotes-in-english/
http://republicdayquotes2016.com/happy-republic-day-2016-speech-essay-paragraph-for-school-students/
http://republicdayquotes2016.com/republic-day-2016-slogan-poster-sayings/
http://republicdayquotes2016.com/happy-republic-day-2016-whatsapp-status-whatsapp-dp/
http://republicdayquotes2016.com/famous-republic-day-images-quotes-26th-january-2016/

Republic Day 2016 Slogan | Poster | Sayings

Happy Republic Day 2016 Whatsapp Status & Whatsapp DP

Famous Republic Day Images with Quotes on 26th January 2016

Happy Republic Day 2016 Speech | Essay | Paragraph for School Students

Happy Republic Day 2016 Quotes in English

Happy 26th January Republic Day Pictures

Indian Flag Pictures – Images for Republic Day 2016 (गणतंत्र दिवस)

Happy Republic Day 2016 Sms Wishes

Happy Republic Day 2016 Quotes in Hindi

Why is Republic Day Celebrated in India on 26th January

SUMIT KUMAR said...

Happy propose day status for whats app, Facebook
best images for propose day Download
Teddy Day Images Wallpapers Pics Photos Hd download
Valentine day week schedule 2016
Top 10 Valentines day wishes for boyfriend, husband, girlfriend, wife, love.
www.99valentinesdayquotes.com

Elle Setar said...

Happy Valentines Day 2016
Valentines Day Wishes 2016
Happy Valentines Day Greetings for GF
Happy Valentines Day Love Cards
Happy Valentines Day Surprise Ideas
Happy Valentines Day Images HD
Happy Valentines Day Funny Quotes
Happy Valentines Day SMS Messages

Ankit Das said...


Happy Valentines Day 2016

Valentines Day Images

Happy Valentines Day Images

Valentines Day 2016 Images

Ankit Das said...

Euro Cup 2016
Euro Cup live Streaming

Movies Gossips said...

happy holi wishes 2016
happy holi 2016 images
Happy Holi 2016 Wishes,Images,Songs,Greetings,Messages,Funny Jokes,Quotes,Wallpapers
happy holi 2016 wallpapers
happy holi messages 2016
happy holi celebration 2016

gaurav joshi said...

happy Holi
Happy Holi Message
Happy Holi Wishes

happy easter day
easter sms
happy easter images
easter message
easter day quotes
easter day wishes
easter good friday quotes
easter poems

happy good friday
good friday sms
good friday images
good friday message
happy good friday quotes
happy good friday wishes
happy good friday quotes
good friday poems
good friday Ecards


freedom 251 Online Booking
latest recruitments 2016
cydia Iphone
Cheap Car Insurance
Brightwebcorner.com

Ankit Das said...

Want to know about Exam Reasults 2016. Get CBSE 10th Result 2016,PSEB 12th Result 2016,PSEB Result 2016,Board Exam Result 2016. Visit my blog.
Exam Result 2016
Board Exam Result 2016
CBSE 10th Result 2016

shahbaz said...

I’m extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see a great blog like this one nowadays.Las Vegas Car Service

robin singh said...


happy fathers day 2016
happy fathers day SMS 2016
happy fathers day Wishes 2016
happy fathers day Message 2016
fathers day SMS 2016
fathers day Wishes 2016
fathers day Message 2016
fathers day Images 2016
fathers day Wishes From Son 2016
fathers day Quotes 2016
fathers day Message From Daughter 2016
sultan movie
sultan movie release date
sultan movie under yash raj banner
sultan movie cast
sultan movie first look
sultan movie Official Teaser
sultan movie Official Trailer
sultan movie Official Poster
sultan movie shooting locations

Dr Rishi said...

Live Streaming Euro Cup 2016
Euro Cup 2016 Live Streaming Channels
Euro Cup 2016 All Matches Predictions
Euro Cup 2016 Points Table
Schedule Euro 2016 Fixtures
Who Will Win Copa America 2016

Astrology Prediction Euro Cup 2016
Euro Cup 2016 Winning Prediction
UEFA Euro Cup 2016 Tv Channels
Team Standings Euro Cup 2016
Who Will Win Euro Cup 2016


Happy Canada Day 2016
Happy Independence Day 2016

suhail alam said...

happy fathers day
happy fathers day SMS
happy fathers Wishes
4th of july sms
4th of july quotes

suhail alam said...

Happy Eid 2016
Happy Eid SMS 2016

suhail alam said...


fathers day 2016
fathers day sms 2016
fathers day wishes 2016
fathers day quotes 2016
fathers day message 2016
fathers day greetings 2016
fathers day Images 2016
fathers day songs 2016
fathers day poems 2016
fathers day wallpapers 2016
fathers day Pictures 2016
fathers day Wishes From Son 2016
fathers day Poems from Daughter 2016
fathers day gift ideas 2016
fathers day sayings 2016
fathers day quotes from son 2016
fathers day message for facebook 2016
fathers day cards 2016
fathers day whatsapp status 2016
fathers day sms message 2016
fathers day quotes sms 2016
fathers day cards 2016
fathers day prayers 2016

suhail alam said...

Fatherday15.com
Father's Day 2016
Fathers Day wishes 2016
Fathers Day Message 2016
Fathers Day Quotes 2016
Fathers Day Greetings 2016
Fathers Day SMS 2016
Fathers Day SMS Wishes 2016
Fathers Day SMS Message 2016
Fathers Day Images 2016
Fathers Day Wishes from son 2016
Fathers Day Quotes 2016
Fathers Day Poems 2016
Fathers Day Wishes From Daughter 2016
Fathers Day greetings 2016
Fathers Day wallpapers 2016
Fathers Day gift ideas 2016
Fathers Day songs 2016
Fathers Day Sayings 2016

suhail alam said...


Fathers Day message wishes 2016
Fathers Day quotes in Spanish 2016
Fathers Day message from son 2016
Fathers Day Printable Cards 2016
Fathers Day Poems from Daughter 2016
Fathers Day greetings from Daughter 2016
Fathers Day quotes from son 2016
Fathers Day wishing message 2016
Fathers Day whatsapp status 2016
happy Fathers Day quotes 2016
Fathers Day facebook whatsapp message 2016
Happy Fathers Day quotes 2016
30 unique Fathers Day quotes 2016
Fathers Day cards 2016
Fathers Day prayers 2016

Raushni Singh said...

what is independence day
usa independence day
america independence day
independence day images
happy 4th of july images
happy 4th of july pictures
independence day pictures
independence day pics
the independence day
4th july pictures
4th of july fireworks
4th july celebrations
independence day Wishes
fourth of july quotes
independent quotes
4th of july wallpapers
4th of july photos
4th of july quotes
4th of july nail designs
4th of july nail Arts
fourth of july nails
happy birthday america
americas birthday
independence day sale
poem on independence day
independence day history
july 4th sale
4th of july sales
independence day
4th of july
4th of july events
july 4th fireworks

Ankit Das said...

Want to know regular updates of Euro Cup 2016????
Get Euro Cup live Streaming,Euro Cup 2016 Schedule,Euro Cup 2016 Fixture,Euro Cup 2016 Live Streaming,Euro Cup 2016 Live Stream,Euro Cup 2016 Live Score.
Venue-France,From 10th june-10july. 24 teams,10 stadiums. Stay updated.Watch Germany vs Italy Live Streaming.