如何从 IDE 或构建脚本中对 Flex 应用程序进行单元测试?

发布于 2024-07-04 15:25:37 字数 360 浏览 8 评论 0原文

我目前正在开发一个应用程序,其前端是用 Adob​​e Flex 3 编写的。我知道 FlexUnit< /a> 但我真正想要的是 Ant/NAnt 的单元测试运行器以及与 Flex Builder IDE(又称为 Eclipse)集成的运行器。 有吗?

另外,除了 Cairngorm 之外,还有其他关于如何“以正确的方式”进行 Flex 开发的资源吗?微架构 示例?

I'm currently working on an application with a frontend written in Adobe Flex 3. I'm aware of FlexUnit but what I'd really like is a unit test runner for Ant/NAnt and a runner that integrates with the Flex Builder IDE (AKA Eclipse). Does one exist?

Also, are there any other resources on how to do Flex development "the right way" besides the Cairngorm microarchitecture example?

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

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

发布评论

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

评论(4

沧桑㈠ 2024-07-11 15:25:37

在我的项目中,我们使用 Maven 构建 Flex RIA 和基于 Java 的后端。 为了构建和测试 Flex 应用程序,我们使用 flex-mojos maven 插件。 他们为我们做了出色的工作,我强烈建议使用 Maven 而不是 Ant。

话虽这么说,如果您已经在使用 Ant,那么转换到 Maven 可能会有点棘手。 因此,如果您处于这种情况,我建议您使用此处提供的 Flexunit 任务: Ant Task

这两个库的作用基本相同,它们在窗口中启动生成的 flexunit 测试运行器 mxml 应用程序,并使用 JUnit 测试运行器打开返回到构建过程的套接字连接。 令人惊奇的是它的效果非常好。 唯一的问题是你不能无头运行它,所以如果你想从 CI 服务器运行构建,你必须确保该进程能够启动新窗口,否则它将无法工作。

On my project we're using Maven to build both our Flex RIA and the Java-based back end. In order to build and test the Flex app we use the flex-mojos maven plugins. They do a great job for us and I would highly recommend using Maven over Ant.

That being said, if you're already using Ant it can be a little tricky to transition over to Maven. So if you're in that position I would recommend using the flexunit tasks available here: Ant Task

Both of these libraries do basically the same thing, they launch a generated flexunit test runner mxml application in a window and open a socket connection back to the build process using a JUnit test runner. Amazingly enough it works pretty well. The only problem is that you can't run it headless so if you want to run the build from a CI server you have to make sure that process has the ability to launch new windows otherwise it won't work.

孤城病女 2024-07-11 15:25:37

关于如何以正确的方式开发 Flex 应用程序,我不会过多关注 Cairngorm 框架。 它确实声称展示了“最佳实践”等等,但我想说事实恰恰相反。 它基于全局变量的使用以及您应该尽量避免的其他事情。 我概述了一些我博客上的问题

我建议您查看 Mate 框架,它有很好的文档和很好的示例来帮助您继续前进。 它充分利用了 Flex 的潜力,不像 Cairngorm 和 PureMVC 那样依赖全局变量,并且可以编写更多解耦的代码。

About how to develop Flex applications the right way, I wouldn't look too much at the Cairngorm framework. It does claim to show "best practice" and so on, but I would say that the opposite is true. It's based around the use of global variables, and other things you should try to avoid. I've outlined some of the problems on my blog.

I would suggest that you look at the Mate framework instead, which has good documentation and good examples to get you going. It uses Flex to its full potential, doesn't rely on global variables as Cairngorm and PureMVC, and it makes it possible to write much more decoupled code.

浊酒尽余欢 2024-07-11 15:25:37

dpUint 测试框架有一个使用 AIR 构建的测试运行程序,可以与构建脚本集成。

还有我的 FlexUnit 自动化套件,它对 FlexUnit 的作用或多或少相同。 它有一个 Ant 宏,可以将测试作为 Ant 脚本的一部分运行,例如:

<target name="run-tests" depends="compile-tests">
  <flexunit swf="${build.home}/tests.swf" failonerror="true"/>
</target>

The dpUint testing framework has a test runner built with AIR which can be integrated with a build script.

There is also my FlexUnit automation kit which does more or less the same for FlexUnit. It has an Ant macro that makes it possible to run the tests as a part of an Ant script, for example:

<target name="run-tests" depends="compile-tests">
  <flexunit swf="${build.home}/tests.swf" failonerror="true"/>
</target>
阳光下的泡沫是彩色的 2024-07-11 15:25:37

FlexUnit 的替代方案是 AsUnit 测试工具。 ActionScript 2 和 3 有版本。它还与构建工具 Project Sprouts 具有良好的集成对于 Flex 和 Flash 来说,与 ant 类似,但是它使用 ruby​​ rake 任务,并包含与 Maven 类似的出色的依赖管理。

但据我所知,没有 IDE 集成。

An alternative to FlexUnit is the AsUnit testing tools. There are versions for actionscript 2 and 3. It also has good integration with Project Sprouts, which is a build tool for Flex and Flash similar to ant, however it uses ruby rake tasks and includes excellent dependency management along the lines of maven.

No IDE integration that I know of however.

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