I've been automating tests for our restful api's using retrofit and testNG. Basically, I create a POJO-Model... send the request in retrofit and do the assertions on the model.
Example:
public interface GitHubService {
@GET("/users/{user}/repos")
List<Repo> listRepos(@Path("user") String user);
}
@Test
public vod testGitHub(){
Repo repo = GitHubService.listRepos("me").get(0);
Assert.equals(repo.getRepositoryName(), "MyFirstRepository");
}
I really like the approach, I can easily integrate it into Selenium integration tests.
However, I've noticed a few people want to focus on API Testing with JMeter. I've only used JMeter for load/performance testing... not functional tests.
It seems good for a functional test.. if you only have a handful, but if you have 400-500 test cases.. it seems like a nightmare to maintain.
Can you recommend pros/cons about using JMeter for functional tests, and recommend any other good API test frameworks, unless retrofit already looks good.