Actionscript Unit Test Framework Sample
//TestCaseSample1.as
package {
import advancedflex.debugger.aut.framework.TestCase;
import advancedflex.debugger.aut.framework.ns.*;
public class TestCaseSample1 extends TestCase {
//只测试
test function a():void {
console.print("aa");
}
//测试并检测是否超时(验证代码的效率时用)
time function b():int {
console.print("bb");
//超时的时间()
return 10;
}
}
}
//TestCaseSample2.as
package {
import advancedflex.debugger.aut.framework.TestCase;
import advancedflex.debugger.aut.framework.ns.*;
public class TestCaseSample2 extends TestCase {
//只测试
test function cc():void {
console.print("aaa");
}
//测试并检测是否超时(验证代码的效率时用)
time function dd():int {
console.print("bbb");
return 10;
}
}
}
//Main.as
package {
import advancedflex.debugger.aut.framework.TraceConsole;
import advancedflex.debugger.aut.framework.TestSuite;
public class Main {
public function TestTests() {
new TestSuite()
.addTest(new TestCaseSample1())
.addTest(new TestCaseSample2())
.startTest(new TraceConsole());
}
/*你也可以这样写
public function TestTests() {
new TestCaseSample1().startTest(new TraceConsole());
new TestCaseSample2().startTest(new TraceConsole());
}*/
}
} ![[Google]](http://www.google.com/logos/Logo_25wht.gif)
![[Synchronous Space]](http://weihe924stephen.googlepages.com/syncspace-banner.jpg)
![[Creative Commons License]](http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png)
![[Add to Google]](http://buttons.googlesyndication.com/fusion/add.gif)
![[Aggregated by MXNA]](http://weblogs.macromedia.com/mxna/images/mxna88x31.gif)
![[Flex.org]](http://www.flex.org/images/flexorg.gif)
![Validate my Atom 1.0 feed [Valid Atom 1.0]](http://validator.w3.org/feed/images/valid-atom.png)
![Validate my RSS feed [Valid RSS]](http://resource.googlecode.com/files/valid-rss.png)
![[I heart FeedBurner]](http://www.feedburner.com/fb/images/pub/i_heart_fb.gif)
没有评论:
发表评论