testdriven.com Wrangling quality out of chaos

Speeding up Grails Selenium Test Development

10.24.2012 · Posted in News by David Vydra

A big part of achieving Continuous Delivery is taking care of your developers by giving them the best tools possible. On my current project we encountered just such a situation. We decided to use Spock  with Selenium for our functional testing. The documentation suggested that we run using ‘grails test-app’ but the startup time using this approach was too slow on our machines — over 60 seconds. To remedy this, we decided to write our tests under src/groovy and filter the test classes out when building the production war. This has greatly speeded them up — they started up in 7 seconds.

But we were not done yet. We wrote a simple runner UI page and in the controller created an embedded JUnit Runner . We configured it to keep the browser open between tests. Now our tests start in well under one second! Another advantage of this approach is that our domain objects and services are available from the Spock specification and we can use them directly in the setup() section, thus speeding up the overall test time even more.

Remember: Speed matters! Developer Experience (DX) matters!

Comments are closed