Category: Moving to Grails

  • Updated asciidoctor gradle configuration for gradle 7

    After upgrading to gradle 7 some problems occured. Here’s the minimum build.gradle to make it work:

  • Geb testing with select2

    Found this article which led me close. The author states that both an EmptyNaviagtor and NonEmptyNavigator should be created, however since the EmptyNavigator did not add any functionality it does not need to be created. First create NonEmptyNavigator The navigators should be placed somewhere inside “integration-test/groovy”. The author First create NonEmptyNavigator.groovy: The original select did […]

  • Geb setup with automatic driver downloading

    Got a new computer. Setting up geb can actually be easier than earlier described. build.gradle The webdriver-binaries-gradle-plugin will actually download the wanted drivers for you. First add dependency, add plugin and define dependencies: Configuration of the plugin tells which driver-versions to download. Defining and loading drivers i GebConfig.groovy Defining the test-environments you want to test: […]

  • Searchable comboboxes

    Comboboxes, ie. html <select>, are not searchable by default. This is only ok for very short lists. After a short search i found the https://select2.org/ which was quite easy to use with Grails. I will walk through the steps needed to make it work in a new project. First create an application to run the […]

  • Geb testing – revisited

    I have now written a couple of domain geb tests and overcome the first practical obstacles. Internationalization Firefox and chrome browsers language is Norwegian, while htmlUnit is English. This means that labels et.c. will change with the configured language of the browser. Starting with this EmployeeListPage: And then change the title: I put code used […]

  • Geb testing on linux

    I started with downloading https://guides.grails.org/grails-geb-multiple-browsers/guide/index.html and followed the guide. Running the test with HtmlUnit worked at once. The Chrome test worked once the drivers had been installed. Firefox test gave a few error messages. After some searching, and re-reading the message I noticed this “The path to the driver executable must be set by the […]

  • Documentation – rest api

    When resarching documentation for the previous blog posts I stumbled upon this project: https://github.com/grails/groovy-rest-doc where Sergio del Amo have writen a tool to help document a rest api. First I downloaded the whole code, and run integration test, then asciidoctor task. Now lets see how this works with a new project. Then create a domain […]

  • Documenting your Grails application – part 2

    In this blog post I will try to make write some documentation with ascii-doctor work. Here’s the asciidoctor user manual: https://asciidoctor.org/docs/user-manual/ First test: Can I simply write adoc’s instead of gdoc’s? Let’s create a project and see what happens: Add the plugin to build.gradle: Reload the gradle project and the task docs will be awailable […]

  • Documenting your Grails application – part 1

    The purpose of this post is to find out how the docs plugin works and figure out how to generate documentation close to the code. This will be done over several posts. The first post will be looking at grails-doc plugin. The second looking into asciidoctor. Finally a summary / conclusion. Here’s the quick reference […]

  • Changing log level at run-time

    Sometimes you need to change log-level for parts of your application at run-time. Most likely for debugging. When researching this topic I found a useful trait that logs log-level. https://github.com/jfrosch/GrailsLoggingIssue With this I created a LogLevel controller to visualize and manipulate log-levels: The loggerList variable gets very long if not filtered. Here’s the logLevel/index.gsp: It […]