Is there a Java package for testing RESTful APIs?

I'm going to dive into testing the RESTful service. Most of our systems are built on Java and Eclipse, so I hope to stay there.

I already found rest-client ( http://code.google.com/p/rest-client/ ) for manual and search testing, but is there a stack of java classes that can make my life easier? I use testNG for the test platform, but I will love helper libraries that can save me time.

I found http4e ( http://www.ywebb.com/ ), but I really would have liked something FOSS.

+5
source share
6 answers

Would JMeter be an option? It has HTTP request samplers that support all HTTP methods and assertions to verify the response.

Another alternative could be something like soapUI, which has an API that can be integrated with your test cases, although I have not tried it.

+3
source

You can use REST Assured , which makes it very easy to test and test Java REST services from JUnit or TestNG. For instance. say a GET request to a service called "/ lotto" returns the next JSON

{ "lotto":{ "lottoId":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[{ "winnerId":23, "numbers":[2,45,34,23,3,5] },{ "winnerId":54, "numbers":[52,3,12,11,18,22] }] } }

then you can make a request and check the response (in this case, the lotto identifier is 5) using REST Assured, like this:

expect().body("lotto.lottoId", equalTo(5)).when().get("/lotto");
+8

CXF, -, REST. REST, , CXF - , , -.

+1
+1

- rest-client . testNG XStream, , .

0

, , concurrency, deployes.

, Johan, REST Assured , , :

http://uttesh.blogspot.com/2012/09/spring-rest-web-service-test.html

spring, , spring, , .

libs spring , REST Assured, ;)

0

All Articles