Archive

Archive for the ‘Uncategorized’ Category

ControllerUnitTestCase: Documentation Has Arrived

November 19th, 2009 No comments

My team started on our first Grails app back in mid-August.  I set out to provide good examples of using the new testing features in Grails 1.1 to encourage the rest of the team.  Domain class testing went great, as did Service testing.  Unfortunately, there wasn’t any documentation on the ControllerUnitTestCase class in the Grails User Guide, and I couldn’t find any blog or forum posts to help out.  I tried creating an instance of it and tossing in a call to mockController(), but I didn’t get very far.  I had to shift focus to other tasks before I could dive into the source code itself and figure out what it did, so progress stopped for a while.

Fast forward to today when I finally had a strong need for a controller unit test setup.  I dove into the code and realized three things very quickly:

  1. You don’t need to call mockController().  It does that for you based on the name of the test class itself.
  2. You don’t want to call the constructor of your controller class in the test cases.  Use the newInstance() method instead so that all the proper scaffolding is put in place.
  3. You don’t even have to call newInstance() most of the time because the setUp() method inits a controller variable for you already.

Doh!  I wish I had taken 15 minutes back in August to look at the source.  It would have saved quite a bit of time by encouraging us to get proper controller test cases in place faster.

To add insult to injury, after spending that time and more getting some test cases just right, I decided to try a search for more documentation online again.   This time there was an answer to my query for help.  A post to the grails-user mailing list less than a month ago generated several responses with useful info, including Scott Davis posting about the most recent addition to his Mastering Grails series which was published just days before the post.

So nine months after the release of Grails 1.1 there is now good documentation on this great piece.  Many thanks to those who pulled it together.

Fun at the ISWC

October 27th, 2009 No comments

I am sitting in the opening session of the International Semantic Web Conference (ISWC 2009) right now.  The conference chairs normally give stats about where submitted papers are from, primary topics, etc.  This time they decided to have some fun.  They did a full text extraction on all the papers, removing stop words and names and then running a Porter stemmer on the text.  They then came up with the list of words most used in accepted papers and those most used in rejected papers. Finally, they graphed the words by the largest difference in occurrence between the accepted and rejected papers.  So if you want to get a paper accepted at a semantic web conference, don’t write about Europeans, users, or people in general.  Do write about services and arguments (or, at least, words with the stems ‘servic’ and ‘argu’).  At least, that’s the rule this year.

Who says theoreticians don’t know how to have fun?

Hello world!

July 30th, 2009 No comments

Welcome to my new site.  I’ve had this domain for a few years and thought it was time to activate it.  Everything before this post was imported from my old blogger account, points-and-edges.blogspot.com.

Categories: Uncategorized Tags: