使用 FlexUnit 对库和 mxml 进行 Flex 单元测试
我有一些软件类(库)可以在任何 mxml 文件上运行命令。 这些类(库)包装在 SWC 文件中。此 SWC 文件可由任何示例 mxml 应用程序引用(通过添加为 SWC 文件)。 我的问题是我想使用 FlexUnit 针对我的示例 mxml 文件测试这些软件类(库)。也就是说,我应该在 mxml 文件上测试软件类运行的方法。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您真正进行单元测试,那么您应该仅对 mxml 文件的功能进行单元测试,而不是对两者的集成进行单元测试。
设置 flexunit 来测试 mxml 文件上的函数并使用模拟库(例如 ASMock 来模拟库类然后,您可以编写脚本并断言 mxml 文件中的功能按照指定的方式运行。
如果您希望进行集成/功能测试,您可能需要使用 FlexMonkey。它将为您驱动和按下按钮,并允许您断言各种行为/属性。
If you are truly doing unit testing, then you should be unit testing the functionality of the mxml files only, and not the integration of two together.
Set up flexunit to test the functions on the mxml file and use a mocking library (like ASMock to mock the library classes. You can then script and assert that the functionality in your mxml file is behaving as specced.
If you wish to do integration/functional tests, you may want to look at using FlexMonkey. It will drive and press buttons for you and allow you to assert various behavior/properties.