Testing REST webservices [closed]

2019-01-10 03:19发布

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 ?

24条回答
男人必须洒脱
2楼-- · 2019-01-10 03:38

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.

查看更多
叼着烟拽天下
3楼-- · 2019-01-10 03:41

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.

查看更多
The star\"
4楼-- · 2019-01-10 03:42

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

查看更多
成全新的幸福
5楼-- · 2019-01-10 03:43

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.

查看更多
霸刀☆藐视天下
6楼-- · 2019-01-10 03:46

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

查看更多
来,给爷笑一个
7楼-- · 2019-01-10 03:46

Check out Fiddler

查看更多
登录 后发表回答