I would like to write an automated testing suite for a REST API. As we complete new services, we'd like to check to make sure all the previously created services are working as expected. Any suggestions on the best tools to use to accomplish this? I know tools like Apigee exist that allow you to test 1 service at a time, but we'd like for a way to test all services with the click of a button.
相关问题
- Design RESTful service with multiple ids
- Axios OPTIONS instead of POST Request. Express Res
- Plain (non-HTML) error pages in REST api
- Laravel 5.1 MethodNotAllowedHttpException on store
- Google places autocomplete suggestion without coun
相关文章
- 我用scrapy写了一个蛮简单的爬虫怎么封装成一个api啊
- 后端给前端的API接口是怎么用代码写的
- Web Test recorder does not allow me to record a te
- Factory_girl has_one relation with validates_prese
- Convert C# Object to Json Object
- What is the difference between `assert_frame_equal
- Android camera2 API get focus distance in AF mode
- Got ActiveRecord::AssociationTypeMismatch on model
I implemented many automation cases based on REST Assured , a jave DSL for testing restful service. https://code.google.com/p/rest-assured/
The syntax is easy, it supports json and xml. https://code.google.com/p/rest-assured/wiki/Usage
Before that, I tried SOAPUI and had some issues with the free version. Plus the cases are in xml files which hard to extend and reuse, simply I don't like
I collaborated with one of my coworkers to start the PyRestTest framework for this reason: https://github.com/svanoort/pyresttest
Although you can work with the tests in Python, the normal test format is in YAML.
Sample test suite for a basic REST app -- verifies that APIs respond correctly, checking HTTP status codes, though you can make it examine response bodies as well:
At my work we have recently put together a couple of test suites written in Java to test some RESTful APIs we built. Our Services could invoke other RESTful APIs they depend on. We split it into two suites.
I would definitely recommend doing this. It has worked really well for us. The main advantages are:
This suite requires us to do data set up in peer services which means tests generally take more time to write. As much as possible we use REST clients to do data set up in peer services.
Tests in this suite usually take longer to write, so we put most of our coverage in Suite 1. That being said there is still clear value in this suite as our mocks in Suite 1 may not be behaving quite like the real services.
Frisby is a REST API testing framework built on node.js and Jasmine that makes testing API endpoints easy, fast, and fun. http://frisbyjs.com
Example: