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条回答
ら.Afraid
2楼-- · 2019-01-10 03:34

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
查看更多
beautiful°
3楼-- · 2019-01-10 03:34

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

查看更多
男人必须洒脱
4楼-- · 2019-01-10 03:34

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)

查看更多
淡お忘
5楼-- · 2019-01-10 03:34

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.

查看更多
混吃等死
6楼-- · 2019-01-10 03:36

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!

查看更多
我欲成王,谁敢阻挡
7楼-- · 2019-01-10 03:37

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.

查看更多
登录 后发表回答