开发者

Cucumber, Webrat or RSpec testing file uploading

开发者 https://www.devze.com 2023-02-17 12:58 出处:网络
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

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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消