TAG | gradle jetty java groovy test automation
I thought I’d share another feature of gradle that i have found extremely useful, starting and stopping an embedded jetty server when my tests run. This is really useful for projects that host web services as it allows me to hit them and very the correct results plus it verifies the full stack is configured correctly. One could quite possibly also use this setup on web projects and have Geb based tests run against their project.
Given a project setup using the jetty plugin as I described in my previous post, all you need to do is hook jetty into run before and after the test task:
And that’s it. Now whenever you run
gradle test the embedded jetty server will run along with your tests.