3

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.

  • This link should help you blazemeter.com/blog/… – Dhiman Aug 19 '15 at 0:24
  • Thanks, I read this one earlier. I guess I'm looking to see if anyone has experience with a large amount of functional test cases in JMeter... to me.. it seems like a bad idea. I know it "Can work" since we have about 60 test cases currently, but looking at the future of a few thousand... seems like a nightmare. – Will Aug 19 '15 at 0:40
  • > ... and recommend any other good API test frameworks Have a look at sqa.stackexchange.com/a/14308/13048 – masood ghz Aug 19 '15 at 14:20
  • Recommend a useful automation test tool for RESTful API. – Dom Feb 9 '17 at 5:53
  • JMeter exposes API to automate tests programmatically, not in IDE, although to me their API is too verbose: it's like building an XML in Java. I definitely prefer Retrofit or REST-assured when I want to manipulate more on HTTP headers, etc. levels. – dzieciou Feb 9 '17 at 6:49
2

There is a tool designed for APIs testing - SoapUI, you can try it out and see how it goes.

In regards to JMeter - yes, it can be used for functional testing. If your concern is about test scripts readability and maintainability you can check out Taurus - new automated tests configuration and execution engine with clear syntax and very good reporting. You can use it as a JMeter wrapper and your tests will be readable, understandable, editable and VCS-friendly.

See Taurus: A New Star in the Test Automation Tools Constellation article for details.

Hope this helps.

0

JMeter is aimed more at load testing, it is also used for functional testing, but there are better alternatives.

For integration testing of REST APIs you can try HttpMaster.
It supports dynamic parameters and the possibility to assess response data with validations which can be combined into logical expressions.
Nice feature is also the ability to specify global hostname, global query string, and other global data in a project. This can be really helpful with test management because global data can be reused and you are not required to define it for each and every test item. Thus you can change some global piece of data and this change will be immediately visible across all affected test items.

0

We are using SOAPUI for functional testing of Rest API Calls. We are using the free version of it, and have created scripts to make it data driven reading information from excel spreadsheets and generating it's own reports. We probably have a 1,000 or more test cases for one project and another project with several thousand test cases. I would recommend staying away from JMeter for Functional testing, it is not really designed for this.

protected by Community Feb 9 '17 at 12:46

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.