Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Testing Web Services can be done in one of two ways:

  • act like a normal web services client and perform asserts on the returned result
  • using WebTest (with either the XML or Groovy syntax)

We are going to use the Web Service example at:

Being a client

You can be a normal client web service client and perform asserts on the returned results:

Using WebTest

Using the WebTest variations makes sense if you are combining
your tests into an acceptance test suite.

Here is how you would test it using traditional WebTest:

Where addreq.xml would look something like:

and squarereq.xml would look something like:

Alternatively, testing using groovy within WebTest would look like:

Note: you will need to place the jars mentioned on that page in your
webtest lib directory (i.e. groovysoap, stax, jaf and mail jars) when
using this variation.

The first approach (traditional webtest) produces more information in the test
summary reporting but requires you to do more work (i.e. keep the requests around
as XML). It depends if you already have those XML files around for other purposes,
e.g. manual testing.

  • No labels