I need to test web API functions in REST format. Currently using Selenium RC for functionally testing the website. And using XmlUnit
and HttpClient
to functionally test our REST API. But it seems life would be easier if we could really separate our functional testing code into all selenium. Particularly with Selenium 2.0's WebDriver, it looks easier than ever to test XML responses using XPath
.
My thoughts in the Pro XmlUnit+HttpClient
camp:
My thoughts in the Pro Selenium WebDriver
camp:
We're using Spring 3 and hibernate. What's best for functionally testing our API?
Another option might be to use REST Assured, a Java DSL for testing REST services. It allows you to write unit style tests with little boilerplate code for both XML and JSON. Additionally, it provides more advanced features like authentication, XSD / DTD validation, response codes, cookies, etc. More information is available at their usage page.
Disclaimer: REST Assured is an open source project initiated by a colleague of mine.