Cucumber、Webrat 或 RSpec 测试文件上传

发布于 2024-10-22 21:46:21 字数 335 浏览 3 评论 0原文

背景:

我需要执行文件上传。我目前正在使用 Uploadify 将文件直接推送到 s3(但很乐意使用 plupload)。我正在处理的文件很大,我需要显示进度条。一切正常

问题:如何为此设置测试(cucumber)?

Uploadify 和 Plupload 都依赖于 flash(或 silverliht)运行时来直接与 s3 交互。我不知道 Cucumber 或 webrat 能够与 flash(或 silverlight)交互以单击“浏览”按钮并选择文件。

有没有人找到他们满意的解决方案?

谢谢!

Background:

I need to perform file uploading. I am currently using Uploadify to push files directly to s3 (but would be happy to use plupload). The files that i am working with are large, and i need to show a progress bar. Everything works fine

Issue / Question: How do I set up a test (cucumber) for this?

Uploadify and Plupload both rely on flash (or silverliht) runtime to interact directly with s3. I am unaware of a way for cucumber or webrat to be able to interact with the flash (or silverlight) to click the "browse" button and select a file.

Has anyone found a solution that they are happy with?

Thanks!

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

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

发布评论

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

评论(1

何必那么矫情 2024-10-29 21:46:21

Plupload 仍然基于 HTML 表单,如果您关闭 javascript 并加载上传器页面,您就可以看到该表单。

然后,只需在 Cucumber 步骤中使用 webrat 的“click_button”,使用文件固定装置作为文件字段的输入即可。

残酷地说,这可能是可信外部性的一个例子。问问自己“我信任 Uploadify 吗”?如果您回答“是”,您将省略对其的实际上传测试,而只是断言您希望看到的表单字段元素存在于页面上,然后假设成功/失败的模拟响应,表明您的应用程序做了正确的事情。

Plupload is still based on an HTML form, which you can see if you turn off javascript and load your uploader page.

Then it's simply a matter of using webrat's 'click_button' in cucumber steps using a file fixture as the input to the file field.

Being brutal about it, this is possibly an example of a trusted externality. Ask yourself "do I trust Uploadify"? In the case that you answer yes, you omit actual upload tests for it and just assert that the form field elements you expect to see are present on the page, and then assuming a mocked response of success/fail that your application does the right thing.

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