There are generally two types of web services RESTful and SOAP services that need testing. We are able to test both in an automated way using our standard ATF framework. The process is as follows.
Review the API that needs automation – Each Web Service may vary in its API complexity. RESTfull apis tend to be grown organically as a company exposes more of their internal processes to other systems. A system can be an end-user as Google does with its Maps API (https://developers.google.com/maps/documentation/webservices/) or intercommunication between a company’s internal systems. At a recent client they built a trouble ticketing system that used a RESTful API from an intranet website, but also allowed the possibility of creating a separate mobile app that could do a sub-set of the full website functionality. A different client implemented a SOAP service that had a complex specification related to Hotel Reservations. This SOAP web service, posed different technical challenges because we had create a set of domain object from a WSDL. Then we had to create well-formed/logically valid messages. The actual process produced XML that was being logged to a database table with a unique identifier so we could later find our generated message and verify that what was entered on the website matched what was being produced by the web service.
Review security restrictions – Some web services require a handshake to authenticate who is using the web service.
Review data verification requirements – It is possible that a web service request will need to have its individual response verified in addition to checking a website to make sure the web service ultimately produced the desired result. This would be where we would fall back to using our ATF to do website testing after a web service call.
Some technologies we use:
– REST – assured (http://code.google.com/p/rest-assured/) – this uses a nice fluent way of writing assertions
– xml-matchers for Hamcrest – This is useful for both SOAP and RESTful XML api’s
– hamcrest-json – This is useful mainly for RESTful api’s communicating using JSON