Closed as off-topic by user1864610, Jan 26 '15 at 19:13This question appears to be off-topic. The users who voted to close gave this specific reason:. 'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, and what has been done so far to solve it.' – Community, ProgramFOX, AstroCB, Ajay S, reneIf this question can be reworded to fit the rules in the, please. At my work we have recently put together a couple of test suites written in Java to test some RESTful APIs we built.
Swagger offers the most powerful and easiest to use tools to take full advantage of the OpenAPI Specification. Learn More SmartBear is committed to Open Source development. With SoapUI Pro you get comprehensive web services testing, simplified. API test automation has the potential of significantly accelerating the testing and development process. In the SoapUI Pro tool you can do SOAP and REST automated testing, functional testing, performance testing, regression testing and much more.
Our Services could invoke other RESTful APIs they depend on. We split it into two suites. Suite 1 - Testing each service in isolation. Mock any peer services the API depends on using. Other alternatives include, and. Tests the service we are testing and the mocks all run in a single JVM.
Launches the service in JettyI would definitely recommend doing this. It has worked really well for us. The main advantages are:. Peer services are mocked, so you needn't perform any complicated data setup. Before each test you simply use restito to define how you want peer services to behave, just like you would with classes in unit tests with Mockito. You can ask the mocked peer services if they were called.
You can't do these asserts as easily with real peer services. The suite is super fast as mocked services serve pre-canned in-memory responses. So we can get good coverage without the suite taking an age to run. The suite is reliable and repeatable as its isolated in it's own JVM, so no need to worry about other suites/people mucking about with an shared environment at the same time the suite is running and causing tests to fail. Suite 2 - Full End to End. Suite runs against a full environment deployed across several machines. API deployed on Tomcat in environment.
![Testing Tools For Rest Api Testing Tools For Rest Api](https://smartbear.com/getattachment/all-resources/Articles/REST-Testing-For-Beginners/PUTBoardName.png)
Peer services are real 'as live' full deploymentsThis 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.
One of the problems of doing automated testing for APIs is that many of the tools require you to have the API server up and running before you run your test suite. It can be a real advantage to have a unit testing framework that is capable of running and querying the APIs in a fully automated test environment.An option that's good for APIs implemented with Node.JS / Express is to use mocha for automated testing.
In addition to unit tests, its easy to write functional tests against the APIs, separated into different test suites. You can start up the API server automatically in the local test environment and set up a local test database. Using make, npm, and a build server, you can create a 'make test' target and an incremental build that will run the entire test suite every time a piece of code is submitted to your repository. For the truly fastidious developer, it will even generate a nice HTML code-coverage report showing you which parts of your code base are covered by tests or not. If this sounds interesting, here's a that provides all the technical details.If you're not using node, then whatever the defacto unit testing framework for the language is (jUnit, cucumber/capybara, etc) - look at its support for spinning up servers in the local test environment and running the HTTP queries. If it's a large project, the effort to get automated API testing and continual integration working will pay off pretty quickly.Hope that helps. API test automation, up to once per minute, is a service available through.
You create your test scenarios, and execute them. Once those tests do what you expect them to, you can then schedule them. Tests can be 'chained' together for scenarios that require authentication. For example, you can have a test that make an OAuth request to Twitter, and creates a shared token that can then be used by any other test. Tests can also have validation criteria attached to ensure http status codes, or even detailed inspection of the responses using javascript or schema validation.
Once tests are scheduled, you can then have alerts notify you as soon as a particular test fails validation, or is behaving out of established ranges for response time or response size.