Flex:在点击级别测试 UI 组件?

发布于 2024-07-27 01:04:28 字数 1399 浏览 4 评论 0原文

我一直在开发 Flex 组件,我想为其编写一些自动化测试。 问题是,我看过的 UI 测试工具(FlexMonkeySelenium Flex API)没有模拟“足够”:

到目前为止出现的大多数错误都与 Flex 处理的方式有关拖放,这些库无法足够准确地模拟。 例如,我需要测试一个在组件下半部分发生“drop”事件的情况 - FlexMonkey 和 Selenium Flex API 都无法做到这一点(它们可能会模拟鼠标事件,但它们不会包括坐标)。

那么,有没有什么“好”方法来自动化此类测试呢?

编辑:经过大量研究,看起来唯一可以做到这一点的软件是iMacros,仅适用于 Windows,并且界面...缺乏。 所以我将写我自己的。 基本上,它将在 java.awt.Robot 上放置一个 HTTP 接口,以便代码(任何语言)可以模拟鼠标/键盘事件。 如果您有兴趣,请PM我,我会及时通知您。

编辑2:我已经在 BitBucket 上发布了我编写的框架的第一个版本 Blunderbuss: http://bitbucket.org/wolever/blunderbuss/ 。 您需要 Jython 来运行它 (http://www.jython.org/),但之后flex-client 示例应该可以工作。

Vimeo 直播 Blunderbuss 的视频

目前这仍然是一个概念验证,因为我还没有周期来清理它并使其更有用......但也许有足够多的人打扰我会给我那个时间:)

I've been working on a Flex component and I'd like to write some automated tests for it. The trouble is, the UI testing tools I've looked at (FlexMonkey and Selenium Flex API) don't simulate "enough":

Most of the bugs which have come up so far relate to the way Flex deals with dragging and dropping, which these libraries can't simulate accurately enough. For example, I need to test a case where there is a "drop" event which occurs in the bottom half of a component – neither FlexMonkey nor Selenium Flex API can do that (they may simulate a mouse event, but they won't include coordinates).

So, is there any "good" way to automate that sort of testing?

Edit: After much research, it looks like the only piece of software that can do this is iMacros, which is Windows-only and the interface is... Lacking. So I'm going to be writing my own. Basically, it will put an HTTP interface on java.awt.Robot so code (in any language) can simulate mouse/keyboard events. If you're interested, PM me and I'll keep you updated.

Edit 2: I have published the first version of the framework I wrote, Blunderbuss, over at BitBucket: http://bitbucket.org/wolever/blunderbuss/ . You'll need Jython to run it (http://www.jython.org/), but after that the flex-client example should work.

Videos of Blunderbuss live over at Vimeo:

At the moment this remains a proof-of-concept, as I haven't had the cycles to clean it up and make it more useable… But maybe enough people bothering me would give me that time :)

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

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

发布评论

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

评论(4

薄情伤 2024-08-03 01:04:28

我使用 Eggplant 来测试 Flash 和 AIR 应用程序,而无需在代码中添加任何挂钩。 这是一个很棒的工具,但价格相当昂贵。 它通过 VNC 进入系统来模拟真实用户,并使用图像识别(除其他外)与应用程序进行交互。

I've used Eggplant to test Flash and AIR apps without having to add any hooks into the code. It's a great tool but it's quite expensive. It simulates a real user by VNC-ing into a system and uses image recognition - among other things - to interact with the app.

埋葬我深情 2024-08-03 01:04:28

我绝对对您的自定义 Java 类感兴趣,并且(尽管我在 Java 方面还不是最好的……),如果您正在考虑进行协作,我将愿意提供帮助。

至于Flash MouseEvents。 不幸的是,确实没有一种准确的方法来模拟 Flash 中的拖/放体验。 当鼠标生成时,MouseEvents 的处理方式与常规事件非常不同,虽然您可以通过将事件传递到处理函数中来模拟操作,或者通过使调度程序触发新的 DragEvent( DragEvent.DRAG_DROP...与让用户与之交互不同,对于某些功能(例如访问剪贴板),Flash 中的任何内容都无法实现您的目标

- 使用 Flash 。不是用 Flash 编写的用于驱动伪造鼠标事件的东西可能是您最好的选择。

I am definitely interested in your custom Java class, and (though I am not the best at Java (yet...)), I would be willing to help out if you're thinking of making this collaborative.

As to Flash MouseEvents. Unfortunately, there really isn't an accurate way to simulate the drag/drop experience in Flash. MouseEvents, when generated by the mouse, are handled in a very different way than regular events and while you could simulate actions by passing events into the handling functions, or by making the dispatcher fire a new DragEvent( DragEvent.DRAG_DROP..., it will not be the same as having the user interact with it. And for some functionality (like gaining access to the clipboard), nothing inside Flash will accomplish your goals.

To be honest, you're probably headed in the right direction -- using something which is not written in Flash to drive faked mouse events is probably your best bet.

—━☆沉默づ 2024-08-03 01:04:28

我从来没有在 Flex 中使用过它,但最近我偶然发现了 MS Surface SDK 中自动化包的一些信息...在研究了这些可用于测试的类自动化用户行为之后,即将一个假鼠标移至此点,执行此操作。 当您使用 Flex mx.automation 包和类时。 我的猜测(也是希望)是您能够使用这些类实现您想要的目标。

I've never had to use it in Flex but i recently stumbled across some info on automation packages in the MS Surface SDK... after looking into it those classes automated user behavior which can be used for testing i.e. move a fake mouse to this point, perform this action. As you're using Flex mx.automation packages and classes. My guess (and hope) is that you'd be able to achieve what you want using these classes.

蛮可爱 2024-08-03 01:04:28

您还可以尝试自动热键 - 它类似于一个宏编辑程序,但事实证明它非常有效,您可以轻松编写脚本并进行设置。

You could also try auto-hotkey - it is similarly a macro-editing program but it has proven to be very efficient and you can write scripts and set it up very easily.

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