Grails Tips – How to log from a none Grails Artifact

Create a grails app with the rest profile: Create a controller grails-app/controllers/lognongrailsartifact/TestController.groovy Create a Groovy Class src/main/groovy/lognongrailsartifact/NonGrailsArtifact.groovy; not a grails artifact. Note: Grails artefacts get log auto-injected. You will need to inject it manually in this class. Edit grails-app/conf/logback.groovy Run the app Invoke the controller And you will see the log statement: Soeren Glasius pointed […]

Grails Tips: How to output CSV from a Grails 3 Controller

Create an app with the default web profile. Enter the grails console Create a domain class Add a couple of properties to the domain class In grails-app/init/BootStrap.groovy add a couple of domain class instances. The BootStrap init closure runs when the app starts. Create a controller This is the controller content: Several things about the […]

Spock Programmer – Setup / Cleanup Inheritance

Craig Atkinson‘s talk at GR8Conf US Intro to Spock and Geb claimed the next about Spock Cleanup / Inheritance. Might have a hierarchy of test classes for DRY common test code Spock runs the base class setup first Then goes down the inheritance chain cleanup is the reverse, starting at test class then going up […]

Geb Programmer – Hidden Content and Mouse over Events

Lets say we have an HTML page with content hidden until we place the mouse over it. It will look like this: And this is the html If I try to fetch the content with Geb, it will fail because it is hidden. Next test fails. We have several alternatives: A. Call a JS method […]

Geb Programmer – User Agent Spoofing

As often happens on the internet there is already a website to answer your question. If you would like to know what’s your user agent just visit If you run Geb with PhantomJs your user agent will identify you as running PhantomJs. You may be blocked because of that. Fortunately it is easy to […]