2010-12-29 11 views
0

私は、FlashBuilder4でFlexUnit4を使用しています。私がユニットテストしているクラスの多くは、Flash Loggerを利用しています。メインアプリでフレックスユニットでロギング

、ロギングが大幅にデバッグに役立つトレースウィンドウに現れるように、私たちはTraceTargetを使用します。

<!-- route logging to the trace window --> 
<mx:TraceTarget includeTime="true"/> 

私はユニットテストランナーのために同じことをしたいのですがFlashBuilderが(FlexUnitApplication.mxml)を生成するが、私はそれについてどうやって行くのか分からない。 I、もちろん、FlexUnitApplication.mxmlにTraceTargetはを追加することもできますが、ファイルの先頭に警告が言うように、おそらくそれを修正する

<!-- This is an auto generated file and is not intended for modification. --> 

は良いアイデアではありません。

私の質問は、FlashBuilderとFlexUnitで動作するようにログを記録する方法は?

答えて

1

私はthis articleに記載の方法からヒントを取って、FlexUnitApplicationから継承UnitTestRunner.mxml作成:

<?xml version="1.0" encoding="utf-8"?> 
<local:FlexUnitApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          xmlns:mx="library://ns.adobe.com/flex/mx" 
          xmlns:local="*"        
          minWidth="955" minHeight="600"> 
    <fx:Declarations> 
     <!-- send log messages to trace window --> 
     <s:TraceTarget includeTime="true"/> 
    </fx:Declarations> 
</local:FlexUnitApplication> 

をして、代わりにFlexUnitApplication(Preferences->フラッシュのUnitTestRunnerを実行するためのFlash Builderの設定値を設定しますBuilder - > FlexUnit - >カスタムアプリケーション名)。