At this point of time, I can think of two possible tools I use for REST automation.
1. REST-Assured (
http://rest-assured.io/)
REST Assured brings the simplicity of using these languages into the Java domain. For example if your HTTP server returns the following JSON at âhttp://localhost:8080/lotto/{id}â:
{
"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]
}
]
}
}
You can easily use REST Assured to validate interesting things from the response:
@Test public void
lotto_resource_returns_200_with_expected_id_and_winners() {
when().
get("/lotto/{id}", 5).
then().
statusCode(200).
body("lotto.lottoId", equalTo(5),
"lotto.winners.winnerId", containsOnly(23, 54));
}
2. JMeter(
http://jmeter.apache.org/download_jmeter.cgi)
Even though, JMeter was created for load testing, we can use it for functional API testing as well.
JMeter includes all the functionality you need to test an API such as parameterization, plus some extra features that can be taken advantage of to enhance your API testing efforts.