愚人呓语 eidiot’s blog. My flapdoodles.

6七/10

Flex Unit 4 的 Test Suite 生成工具

Read in English: Test suite generator for Flex Unit 4

写了一个 小工具 来生成 AllTests.as 文件给 FlexUnit4 用. 下载 air 文件,安装运行即可。

同过ant调用的示例代码:

  <project name="Test Suiter" default="createSuite">
    <target name="createSuite">
      <exec executable="/Applications/TestSuiter.app/Contents/MacOS/TestSuiter">
        <arg value="/Users/someone/Desktop/SomeProject/tests" />
      </exec>
    </target>
  </project>
21五/10

使用FlexUnit4对as3-signals进行异步测试

Read in English: Async test for as3-signals with FlexUnit4

使用 Robert Penneras3-signals 可以帮助我们节省代码量并写出更整洁的代码. 这是一个由几个代理方法组成的使用 FlexUnit4进行测试的扩展

  • proceedOnSignal
  • handleSignal
  • failOnSignal
  • registerFailureSignal

proceedOnSignal

使用这个方法确认一个signal必须被抛出。

[Test(async)]
public function test_proceedOnSignal():void 
{
    var model:IModel = new SomeModel();
    proceedOnSignal(this, model.changedSignal);
    model.doSomethingChange();
}
6一/10

as3-signals 的 FlexUnit4 扩展

Read in English: FlexUnit 4 Utility of as3-signals

as3-signals 写了一个 FlexUnit 4 的扩展

例子:

Async.proceedOnEvent(this, new SignalAsync(instance.someSignal), SignalAsyncEvent.CALLED);
instance.doSomeThingShouldDispatchSomeSignal();

30十二/09

Built in unit test support in Flash Builder and more I expected

Now we have FlexUnit1 and FlexUnit4 support built in Flash Builder beta 2:

  • Create a test suite class
  • Create a test case class
  • Create a test case class of an exist class and choose which methods to test.
  • Right click a test case class and run it.
  • Right click a test suite class and run it.
  • Choose any set of test suites and test cases (test methods) to run.
  • See test results in FlexUnit Results View
  • To see more detail Click Here.

They are good for unit test, but not for TDD (write test before code).
I wish to see some more:

  • Set the source folder for real code and tests folder for test classes.
  • Create a test case class in the tests folder, and choose if create the class to be tested in the source folder.
  • Create and update test suite classes automatically in every package in the tests folder.
27十二/09

使用 FlexUnit 和 Robotlegs 尝试 TDD

Get the Flash Player to see this content.

尝试使用TDD的小例子(视频)。
Download (Right-click and “save as”)下载(右键另存为)