So, it's on my to-do list but don't hold your breath!
ad-hockery: /ad·hok'@r·ee/, n. Gratuitous assumptions... which lead to the appearance of semi-intelligent behavior but are in fact entirely arbitrary. [Jargon File]
26 Nov 2009
Springcache Plugin Status
So, it's on my to-do list but don't hold your breath!
Tags:
caching,
grails plugins,
spring
21 Nov 2009
Why do Strings behave like a Collection?
void printNames(names) { names.each { println it } }Passing a collection of Strings results in each String being printed. Passing a single String results in each character of the String being printed separately. I would have thought that the Object behaviour was a more appropriate default here (iterators on Object are called once passing the object itself). After all the
.chars
property is available if you really want to represent a String as a collection of characters.The solution is to override the method:
void printNames(String name) { printNames([name]) }Unlike in Java dispatch to such overridden methods in Groovy is based on the runtime rather than declared type of the parameter.
You might think this is a trivial point, but the scenario that keeps biting me is HTTP parameters passed into a Grails controller. If you have multiple inputs with the same name, or a multi-select then sometimes
params.x
is a String and sometimes it's a List of Strings. Any code dealing with that parameter has to handle the two cases separately.
Tags:
groovy
Slides from GGUG
I really wanted to show a few quick examples but I had neglected to consider that a mini display port VGA adapter might be a useful thing to bring and unfortunately with Skills Matter being in the middle of an office move there wasn't one to hand. Luckily I was able to borrow a laptop so at least I could get my slides up on the projector.
Tags:
ggug,
grails plugins,
selenium
5 Nov 2009
Grails Selenium RC Plugin Released
grails install-plugin selenium-rc
to install.For anyone unfamiliar with Selenium RC basically the plugin allows you to write and run Selenium tests in Groovy to functionally test Grails apps using a real browser. The tests run in the functional phase using
grails test-app
or grails test-app -functional
.In terms of compatibility there is a very minor issue with Safari and some slightly more annoying ones with IE - all of which the plugin's default configuration will work around for you. Unfortunately Firefox 3.5 on OSX Snow Leopard doesn't want to play at all due to an open Selenium bug. Firefox on other platforms, Google Chrome and Opera all appear to be 100% compatible.
I've tried to make writing the tests themselves as similar to regular Grails unit and integration testing as possible. Not only that, if you have the Spock plugin installed you can write your Selenium tests as Spock Specifications.
Documentation is here, source code is on GitHub and issues and feature requests can be raised on Codehaus' JIRA. I've got plenty of things to work on for future releases such as Selenium Grid integration and automatic screen-grabbing when assertions fail.
Tags:
grails plugins,
selenium,
testing
2 Nov 2009
Talk on Selenium RC Testing In Grails
The plugin is basically release ready, I'll try to make the final push some time this week so that it's out in the wild in advance of the talk (and hopefully any particularly idiotic bugs are reported and fixed before I make a total fool of myself).
Tags:
grails plugins,
selenium,
testing
Git and Hudson
hudson.plugins.git.GitException: Could not apply tag hudson-Selenium_RC_Plugin-23 at hudson.plugins.git.GitAPI.tag(GitAPI.java:265)It turns out Git needs a username to be set and the hudson user that the Debian package creates when Hudson is installed doesn't have one. Easily fixed by using
sudo nano /etc/passwd
to add Hudson,,,
into the hudson user's entry (if you look at your own entry you should see where it needs to go).
Subscribe to:
Posts (Atom)