Rails Rest API 外部测试

发布于 2024-08-18 05:50:36 字数 353 浏览 3 评论 0原文

我正在 Rails 应用程序之上构建一个 REST Web 服务层,该应用程序将由 Iphone 应用程序使用。响应格式为 XML。

我想构建一些应该在 Rails 堆栈外部的验收测试(并且应该测试所有内容,包括 http 服务器)。测试场景相当复杂,涉及搜索/发布/查看订单的过程。实现这一目标的最佳解决方案是什么?

一个。使用curl/curb 获取请求并使用Hpricot 解析请求的Ruby

脚本硒

C. ..

如果这些测试可以用作集成测试(因此,在每个 git 提交上运行),那就太好了。您会推荐哪种集成解决方案?

一个。诚信

B.巡航控制

C.别的东西

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

客…行舟 2024-08-25 05:50:37

在过去的几年里我使用了三种方法

Active-resource

我发现这太关心看起来像active-record,而不是一个很好的解决方案。在某些情况下,我必须修补部分内容才能正常工作,因为我希望 REST 客户端能够正常工作。

Rest-client

这个宝石非常好 - 有据可查并且按预期工作。我将它与我自己的简单 DSL 结合起来,它比通用测试框架

XML over HTTP

我用它进行性能测试。非常灵活,但学习曲线比 Rest-client 更高。如果您采用这种方法,您可以使用 Net::HTTP 核心类或 HTTParty gem(我没有尝试过,但看起来很棒>

一个非常好的资源是这个 Net:: HTTP 备忘单

对于临时测试,我还发现 Firefox 的 Rest Client 插件非常有用。

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.

半世蒼涼 2024-08-25 05:50:37

在 ruby​​ 模式下使用 selenium-rc,你将成为一个快乐的露营者。 Webrat/Cucumber 已经为您完成了此操作,因此您可以将其放入第二个项目中并以这种方式运行测试,您所要做的就是覆盖主机(因此您将使用您的域而不是 localhost)。

至于CI,恐怕我不知道最好的一个。

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.

无人接听 2024-08-25 05:50:37

你的意思不可能是诚信……如果是这样,答案绝对不是。 CC是一个很好的CI工具。真的很好。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文