views:

5819

answers:

14
+3  A: 

CURL Gets you halfway there. The other half is checking the headers, response codes and entity content to make sure its good. You could use a variety of tools for that (in shell scripting land, piping the header and contents to files, and diffing them might just do the trick). It wouldn't be that difficult to further refine the toolset, maybe stacking curl up with the unit-testing framework of your choice.

I built a rest webservice testing panel with AJAX. It wasn't that difficult at all actually. You have some security issues to work out (i.e. making sure that you have the test suite on the same server, or maybe signed Javascript.)

Jonathan Arkell
Yes, CURL rules for REST testing. http://curl.haxx.se/
bortzmeyer
+3  A: 

Check out Fiddler

TheSoftwareJedi
+6  A: 

You can exercise web services using fairly trivial bits of Python. Depending on your security, you may be able to simply use Python's urllib or urllib2 to do do you REST requests and examine your answers.

Additionally, you might want to use Python unittest to control the execution of the Python tests of your REST services.

class TestSomeREST( unittest.TestCase ):
    def setUp(self):
        REALM = "[email protected]"
        self.client= RESTClient( "localhost", 18000, "tester", "tester", REALM )
    def test_1_get(self):
        response = self.client.get('/this/that/other/2/')
        self.failUnlessEqual(200, response.status_code)
        j1= JSONDecoder().decode(response.content)
        self.assertEquals(2, j1[0]['pk'] )
        entity= j1[0]['fields']
        self.assertEquals('Some Other Group', entity['name'])
        self.assertEquals('E1G2', entity['customer_id'])

The RESTClient class uses urllib2 to pass through digest authentication for each request. It's rather complex, but I can share the essence if it's of interest.

S.Lott
great answer. I personally think that this approach is the most convenient.
MaciekTalaska
A: 

Try Python's httplib. It's very easy, you specify the method, url, and use urllib.urlencode for the parameters/POST body.

This can be combined with the builtin unittest module if you like, for reporting of errors.

A: 

I wrote about calling REST webservices at my blog, see http://ghads.wordpress.com/2008/09/24/calling-a-rest-webservice-from-java-without-libs/

This could be easy utilized for a JUnit testcase or so. There is also a list of some geocoding webservices for testing.

If I shall post the code here, leave me a comment.

GHad
+9  A: 

Please try Firefox addon Poster , which is simple to use and gets you up nd running quickly

Great tool for REST testing.
Bob
Actually, I take back my +1. When inspecting the traffic Poster sends through, it is malformed which causes problems for my webservice. When you add parameters and do either POST or PUT it will not actually send those parameters and it will not send a content-type unless you explicitly add content.
Earlz
A: 

I've been using JMeter for this, especially for stuff like load testing. It's similar to SoapUI (which I've also used), but geared more toward testing web pages, which makes it pretty decent at testing RESTful services, too.

Mike Desjardins
A: 

I've written a program specifically for testing REST Web Services. Its a pretty simple application written in .NET 2.0 (I've only tested it on Windows Vista, but should work on XP also). The application uses HttpWebRequest to make requests, and displays the resulting response, as well as the headers for the request and response. I've done a bit of testing, but I thought it might help you test your web services.

REST Test

+3  A: 

I don't have tested it yet but this Java app seems to be nice to test REST services. There is also a tutorial on Javalobby about it.

Java App: http://code.google.com/p/rest-client/

Tuto: http://java.dzone.com/announcements/wiztoolsorg-restclient-21-rele

Valentin Jacquemin
+4  A: 

Hi,

soapUI (http://www.soapui.org) will do the job as well, check out this blog post to get started: http://www.eviware.com/blogs/oleblog/?p=11

regards!

/Ole eviware.com

Ole Lensmar
+2  A: 

SOA Cleaner, is a test tool that tests both soap and rest (also WCF, but it seems you don't need that feature). It's very intuative, and usable. Written in .NET. A free version is also available. can be downloaded from http://xyrow.com. Good luck!

Clangon
A: 

I'm currently investigating wsclient CLI app for this purpose (http://wso2.org/library/3362). It is quite promising, and can be used to hack a quick test from a bash shell. Of course, as many mentioned here, many of the tools that come with a *nix system will do the job with a tidbit of coding/scripting

verboze
A: 

I'm looking for a PERL module for testing RESTful services.

karthi
A: 

http://search.cpan.org/dist/REST-Client/

gonzo