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.

5
  • This link should help you blazemeter.com/blog/…
    – Dhiman
    Commented Aug 19, 2015 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
    Commented Aug 19, 2015 at 0:40
  • > ... and recommend any other good API test frameworks Have a look at sqa.stackexchange.com/a/14308/13048
    – masood ghz
    Commented Aug 19, 2015 at 14:20
  • Recommend a useful automation test tool for RESTful API.
    – Dom
    Commented Feb 9, 2017 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
    Commented Feb 9, 2017 at 6:49

3 Answers 3

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.

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