前些日子试用了FlexUnit4,发现真的非常的不错,非常的简单,省去了很多的麻烦。现在补个例子,加深理解。
首先你要在你的库中添加FlexUnit4.swc & FlexUnit4UIListener.swc,这两个文件你可以到
现在建立一个要测试的类
package commond { public class SimpleMath { public function add(n1:Number,n2:Number):Number { return n1 + n2; } public function divide(n1:Number,n2:Number):Number { if(n2 == 0) { throw new TypeError("sdfdasdfasd"); } return n1/n2; } } }
然后建立一个测试类
package unit { import commond.SimpleMath; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.soap.WebService; import org.flexunit.Assert; public class SimpleMathTest { private static var simpleMath:SimpleMath; [BeforeClass] public static function init():void { simpleMath = new SimpleMath(); } [AfterClass] public static function runAfterClass():void { // run for one time after all test cases } [Test] public function add():void { Assert.assertEquals(12,simpleMath.add(1,11)); } [Test(expects="TypeError")] public function divide():void { simpleMath.divide(10,0); } [Ignore("Not Ready to Run")] [Test(description="Maybe it's wright")] public function add2():void { Assert.assertEquals(12,simpleMath.add(1,1111)); } [Test(async="true")] public function asny():void { var webService:WebService = new WebService(); webService.wsdl = "http://feeds.adobe.com/webservices/mxna2.cfc?wsdl"; webService.addEventListener(FaultEvent.FAULT,onFalut); webService.addEventListener(ResultEvent.RESULT,onResult); webService.loadWSDL(); webService.getCategories(); } private function onFalut(event:FaultEvent):void { trace("onFalut"); } private function onResult(event:ResultEvent):void { trace("onResult"); } } }
相关推荐
flexunit-4.1.0_RC2-4-4.1.0.16076.zip,flexunit 4
FlexUnit4熟悉与使用,自己做的...不是抄网上的,实用
Flex当前炙手可热的RIA技术,FlexUnit使Flex开发的单元测试成为可能。FlexUnit的目标和思想与JUnit都是差不多的,在此不赘述。FlexUnit也经历了几个版本,目前最新的稳定版是1.0RC版,已经支持了标注式的test,非常...
1 18 跟我StepByStep学FLEX教程------FlexUnit4 alpha 1 0 5 4发布 1 19 跟我StepByStep学FLEX教程------Demo9之FlexUnit4 1 20 跟我StepByStep学FLEX教程------Demo10之DataGrid 1 21 跟我StepByStep学FLEX教程-...
lexunit 详细简单用例 里面带有flexunit.swc 包
flexunit ant版本里面有ant的详细配置
它是简单的 AsUnit/FlexUnit 4 风格的 UI-Unit 框架,但不用于测试。 它是一种快速访问和验证 UI 实现的工具。 | | 例子 赛跑者: public class DemoRunner extends Sprite { public function DemoRunner() { ...
Flex调试专用插件! Flex Builder4 也就 Flash Builder 中会自带的那个!
咕flex挠单位一个Grunt任务插件,用于为基于Adobe Flex / ActionScript / MXML / Flash / AIR / etc的应用运行FlexUnit测试。入门这个插件需要~0.4.2 如果您以前从未使用过 ,请务必查看《指南》,因为它说明了如何...
grunt-flexunit flexunit-server 的 Grunt 插件。 额外要求 除了 npm 模块依赖项之外,运行grunt-flexunit还需要以下内容。 要用于打开swf文件的浏览器 目前仅支持Firefox 浏览器的 Flash Player 插件 xvfb-run ...
flexunit-服务器FlexUnit Node.js 服务器。 该模块接受来自 FlexUnit CIListener 的连接并使用给定的报告器生成结果。使用示例 var fuserver = require ( "flexunit-server" ) ;var reporter = new fuserver . ...
Flash开发人员单元测试在可视树中显示FlexUnit4轨迹的插件。 工作正在进行中
flex开发,做为测试使用,方便提供给flex开发人员测试
它与 FlexUnit 测试流程和 Flex Framework UI 组件完美配合。 Flash 有一项特殊能力——输出看起来总是一样的。 快速、轻便且易于使用 [ Test(async, ui) ] public function defaultColor() : void { var ...
第 4 章: 在 Flash Builder 中使用项目 在 Flash Builder 中创建项目 导出和导入项目 构建项目 运行和调试应用程序 导出应用程序的发行版 使用 Flash Builder 打包 AIR 应用程序 第 5 章: Flash Builder 中的...
与 Macromedia Flex 一起使用的 actionscript 2.0 单元测试框架。 基于 Nunit 等测试框架,全面支持测试 Flex 应用程序,包括异步 Web 服务请求。
4. Connecting to Web Services Part 2: Strengthening the backend 5. BlazeDS remoting and logging 6. Flex messenging Part 3: Going above and beyond 7. Securing and personalizing your application 8...
本文首先阐述了选择Red5禾IFlex进行网页游戏开发的原因,并介绍和分析了两者的概念和原理,并针对网页游戏的难题提出一些解决办法。然后,本文运用UML等方法对...最后,本文用JUnit和FlexUnit对系统进行了单元测试,得
4. Connecting to Web Services Part 2: Strengthening the backend 5. BlazeDS remoting and logging 6. Flex messenging Part 3: Going above and beyond 7. Securing and personalizing your application 8...
著名的xMock框架的ActionScript3实现,是flexUnit框架的扩展。