Hi all,

I've been playing around with some basic servlets (wow, how 1997, right?) to
simulate how RESTful web services work.

When testing SOAP-based web services, JDK 1.6 includes an Endpoint.publish()
command that lets me start a tiny server in a regular Java app, and then in
Gradle I can start that in my tests.  When I test JAX-RS web services,
Jersey comes with an embeddable server called Grizzly, which lets me do
something similar.  I've been wondering, though, if the JDK or Gradle
included any way to do the same approach with basic servlets.

One of the Gradle examples shows how to define a task that depends on
jettyRun.  Calling that task builds a URL and accesses it.   That works, but
the problem is that I have to embed all my testing code inside my Gradle
task.  Plus the results don't show up as part of my overall test cases.

Is there a simple way to do this, or is nothing available?  I suppose I
could just deploy my web app to an actual server and then use a Gradle task
to run Geb tests or something, but I really like the unified build/test feel
I get from the web services approaches I mentioned above.  Or maybe I should
look into somehow using and embeddable Jetty server.  Still, Gradle already
has a Jetty plugin, so there ought to be some way to take advantage of that.

What (if anything) do people here normally do in this situation?

Thanks,

Ken Kousen
-- 
Kenneth A. Kousen
President
Kousen IT, Inc.

Email: [email protected]
Site: http://www.kousenit.com
Blog: http://kousenit.wordpress.com
Twitter: @kenkousen

Reply via email to