Reputation: 52550
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?
Upvotes: 4
Views: 6508
Reputation: 429
If you want to do real functional testing on rest API's, then I can recommend Fitnesse with this fixture: https://github.com/smartrics/RestFixture
Selenium is just a poor choice for this kind of thing.
As for performance testing you can knock up rest API tests in Jmeter in a matter of minutes, no need to pay a 3rd party.
Upvotes: 2
Reputation: 33779
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.
Upvotes: 6
Reputation: 597164
Testing an API does not sound like functional testing but more like unit-testing. So I'd go for XmlUnit+HttpClient
Upvotes: -1