aspose file tools*
The moose likes Web Services and the fly likes Testing restful web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Testing restful web service" Watch "Testing restful web service" New topic
Author

Testing restful web service

Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
I've recently added upload capabilities to a restful web service. However, I'm unsure as to how I can test this capability. Anyone have suggestions?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
What kind of testing do you want to do? Unit testing?
Have you tried testing with soapUI, which not only allows for testing of SOAP web services, but also REST web services.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
Ivan Krizsan wrote:Hi!
What kind of testing do you want to do? Have you tried testing with soapUI, which not only allows for testing of SOAP web services, but also REST web services.
Best wishes!


Hi Ivan,

I'd like to do "integration" testing -- essentially I want to test whether my web service 1. accepts the request 2. processes the multipart post.

No, I haven't tried soapUI since it has no support for multipart post. Thanks.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I can only think of the following way:
- Mock out all subsystems used by the RESTful web service.
- Start the RESTful web service.
If you do not want to start it in the container it is to run in, then you may want to consider Jetty.
- Have a client, either an existing one or one specially implemented for the test, issue requests to the service.
- Assert the usage of the mocked subsystems by the RESTful web service for each request.

If not entirely suitable for your needs, then the above will hopefully provide some inspiration.
Best wishes!
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
junit moght help for Testing restful web service
Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
Ivan Krizsan wrote:Hi!
I can only think of the following way:
- Mock out all subsystems used by the RESTful web service.
- Start the RESTful web service.
If you do not want to start it in the container it is to run in, then you may want to consider Jetty.
- Have a client, either an existing one or one specially implemented for the test, issue requests to the service.
- Assert the usage of the mocked subsystems by the RESTful web service for each request.

If not entirely suitable for your needs, then the above will hopefully provide some inspiration.
Best wishes!


Thanks for the suggestions. I ended up using jetty to start the service and then a ruby script to send multipart posts to the service.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
jersey client supports the Restful WebServices testing.
 
wood burning stoves
 
subject: Testing restful web service