views:

308

answers:

3

I am building a REST Web Service layer on top of a Rails app that will be used by an Iphone application. The response format is XML.

I would like to build some acceptance tests that should be external to the rails stack (and should test everything, including the http server). The test scenarios are quite complex, involving the process of searching/posting/reviewing an order. What would be the best solution to accomplish this?

a. Ruby script using curl/curb to fetch the request and Hpricot to parse the request

b. Selenium

c. ..

It would also be nice that those tests could be used as integration tests (therefore, run on every git commit). What integration solution would you recommend?

a. Integrity

b. CruiseControl

c. something else

+1  A: 

Use selenium-rc in ruby mode and you'll be a happy camper. Webrat/Cucumber already do this for you so you can just put that in a second project and run the tests that way, all you'll have to do is override the host (so instead of localhost you'll be using your domain).

As to CI I'm afraid I don't know the best one.

Chuck Vose
+1  A: 

I've used three approaches over this last few years

Active-resource

I found this to be too concerned with looking like active-record to be a great solution. In some cases I had to patch parts of it to work as I'd like a REST client to behave.


Rest-client

This gem is very good - well documented and does works as expected. I combined this with my own simple DSL and it's worked out better than a generic testing framework


XML over HTTP

I use this for performance testing. Very flexible but the learning curve is higher than Rest-client. If you go down this approach you could use the Net::HTTP core class or the HTTParty gem (I haven't tried this but it looks great>

A really good resource is this Net::HTTP cheat-sheet


For ad-hoc testing I've also found the Rest Client add-in for Firefox very useful.

Chris McCauley
A: 

you can't possibly mean mks integrity...if so, the answer is anything but. CC is a good CI tool. really good.

greg