• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unit Testing Web Services.

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

we are working on a web services project using JAX-WS and JAXB. All is fine and we are able to consume as well as publish our web services. The problem is in unit testing these web services using Junit.

Is there a standard generic approach to Unit Test Web Services, please share the names / URLs of any tools or articles on the same regard.

Thanks
 
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try soapUI
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
As before, soapUI is a nice tool. Take a look at the following links:
http://www.soapui.org/gettingstarted/functional.html
http://www.soapui.org/gettingstarted/mocking.html
Finally, this page talks about how unit tests created in soapUI can be run from your own JUnit tests:
http://www.soapui.org/userguide/commandline/testcaserunner.html
Best wishes!
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The approach we have generally taken for testing web services has been to write the tests on the pojos used by the webservice instead of the services themselves. The impl code merely calls the pojo with the document after applying security and transaction policy. This allows separation between the webservice implementation and our logic. This also allows for much quicker unit testing.

If you want to be a purist about it, testing through the webservice is more of an integration test. For those tests you also have to account for security, transaction policies etc. Much more that a simple junit test. For that testing we build the docs, execute the service and check the results using relative xpath expressions.

Thanks,
Don.
 
Author
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree, soapUI is a very nice open source product for testing both SOAP and RESTful web services. You can construct test cases/suites in it, and even use it to act as a server for mock-requests (they offer a commercial alternative that has a few more bells-and-whistles). In many of my examples in the book I have soapUI integrated in with ANT for testing of the example services (i.e., you run an ant target that will automatically launch soapUI along with the appropriate project).
 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.
 
reply
    Bookmark Topic Watch Topic
  • New Topic