Question

My organization is working on building RESTful webservices on JBoss appserver. The QA team is used to testing SOAP webservices so far using SoapUI. SoapUI has a new version that has REST capabilities. We're considering using that.

  1. Are there any publicly available RESTful services available on the net for free that someone could test ?
  2. What tools are available(and used) for testing RESTful web services ?
Was it helpful?

Solution

soapUI will do the job as well, check out this blog post to get started.

OTHER TIPS

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

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 = "blah@blah.com"
        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.

Check out Fiddler

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.)

To test a REST service you can try REST Assured which makes it very simple to test REST services and validating the response in Java (using JUnit or TestNG).

Check out Postman - https://chrome.google.com/webstore/detail/fdmmgilgnpjigdojojpjoooidkmcomcm/. This is a tool I have been working on over the past several months and lately from the feedback that I have been getting it's becoming quite useful for large REST projects while helping with basic REST endpoint testing.

The code for this is available on Github as well. https://github.com/a85/POSTMan-Chrome-Extension

The simplest way to test REST web service is using curl in terminal.

There are some codes I used to test my web service of rails. You may modify them to fit your services.

GET

curl http://localhost:3000/courses.json

POST

curl -H "Content-Type:application/json"  -d '{"courseCode":"55555","courseName":"SEEEE","courseYr":999}' http://localhost:3000/courses.json

PUT in Raills: eg1(with all fields) :

curl -H "X-Http-Method-Override: put" -H "Content-Type:application/json"  -d '{"courseCode":"123456","courseName":"AAAAAAAA","courseYr":12345}' http://localhost:3000/courses/5.json

eg2(with the field only be edited) :

curl -H "X-Http-Method-Override: put" -H "Content-Type:application/json"  -d '{"courseYr":999999999}' http://localhost:3000/courses/3.json

DELETE in rails with id provided

 curl -H "X-Http-Method-Override: delete" -H "Content-Type:application/json"  -d '{"id":4}' http://localhost:3000/courses/5.json

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

you can use the Simple REST Client is an extension for Google Chrome too https://chrome.google.com/webstore/detail/fhjcajmcbmldlhcimfajhfbgofnpcjmb

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!

I'm testing RESTful services with an in house .NET framework (no problem porting it in Java). Basic principles:

  • build client (to make the calls)
  • build type classes (XML and JSON)
  • deserialize response
  • assert stuff

If you want more info, I'm glad to talk.

I'm using REST console extension for Google Chrome and It's by far the best i've tried. It also supports various security mechanisms like OAuth

(update 2: fix link)

For java, there also exists RESTFuse, which allows to develop unit tests which may look like this:

@Rule
public Destination destination = new Destination("http://localhost:8080/rest/");


@HttpTest( method = Method.GET, path = "/status" ,authentications =
   @Authentication(type = AuthenticationType.BASIC, user = "joe", password = "doe")
)
public void testAuthRhqadmin() {
    com.eclipsesource.restfuse.Assert.assertOk(response);
}

This test runs against http://localhost:8080/rest/status and authenticates as user joe with password doe. The body of the method then checks that the GET call returns a 200 status code.

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.

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.

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

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

If you like using Ruby there's a REST-Client gem for it

For testers I find ruby is a really easy language to learn, and it has some excecllent tools like Cucumber for doing BDD style acceptance tests.

I've tried numerous REST clients and by far the best I've used is the Chrome app: DHC.

DHC (aka Dev HTTP Client) is designed and developed by a developer for developers to make direct HTTP resource discovery, manipulation and testing more easily. Beside the main function, sending/receiving custom HTTP requests/responses, it allows permanently to save a request to a local repository for later reuse and moreover the request declaration can include variables that are context specific. With the use of contexts you can easily switch between various environments without modifying request declaration. (e.g. from a test environment to production)

Testing REST full web services is a easy task to do. Free ad-ons are available on the browsers as REST Client from where you have to send a web service with expected/required method type: GET/POST/PUT/DELETE If the parameters are matched then output will get generated in the body of browser.enter image description here

I know it is very old question, but could be helpful to others. Just to answer your first question you can check here to get some REST webservices to test.

Fiddler and Poster plug in Firefox can be use to test any REST web services. SoapUI also comes with RESTful webservices support.

For advanced REST testing you can try HttpMaster.
It supports dynamic parameters, friendly viewers for XML/JSON, and various types of response data validations that can be combined into logical expressions.
For basic http requests some browser plugin will be sufficient.

OnionTest still beta , but quite useful

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top