使用 Cucumber 测试 SWFUpload
在一个项目中,我最近用SWFUpload替换了一个简单的基于表单的文件上传。 当 SWFUpload 返回成功时,我会生成一个表单以向上传的资源添加标签。
我希望能够测试将数据输入到标签文本框中,但要做到这一点,我(认为我)需要伪造 SWFUpload。
过去有人这样做过吗? 我无法通过谷歌找到任何东西,并且黄瓜文档中似乎没有任何内容:测试Flash。
In a project, I recently replaced a simple form-based file upload with SWFUpload. When SWFUpload returns a success, I generate a form to add tags to the uploaded asset.
I'd like to be able to test inputting data into the tags textbox, but to do that I (think I) need to fake out SWFUpload.
Has anyone done this in the past? I haven't been able to find anything via google, and there doesn't seem to be anything in the cucumber docs re: testing Flash.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你根本不需要伪造 flash,因为 swfupload 为你做的只是模拟一个简单的 http post。
如果您对 swfupload 发布到的同一操作/控制器执行手动 http 发布,并确保帖子的文件字段的名称与 swfupload 传递的 swf 参数 (params[:Filedata]) 相同,您应该得到效果相同。
另外,要回答上面 Swanand 的评论,您需要破解 CGI::Session。 尝试 http:// /blog.isshen.com/2008/10/5/making-swfupload-and-rails-2-1-sessions-work-together
I dont think you need to fake flash at all, because all swfupload is doing for you is simulating a simple http post.
If you do a manual http post to the same action/controller that your swfupload is posting to and make sure the file field of your post is named the same as the swf parameter which swfupload passes (params[:Filedata]) you should get the same effect.
Also to answer Swanand's comment above you need to hack CGI::Session. Try http://blog.isshen.com/2008/10/5/making-swfupload-and-rails-2-1-sessions-work-together
我最近偶然发现这个插件它可能可以帮助你你需要做什么。 您可以在此处阅读更多内容。
I recently stumbled upon this plugin which may be able to help you with what yo need to do. You can read more here.