2011年8月8日 星期一

FlexMonkey 與 Hudson 整合進行 UI 測試

這是一個複雜的演練,花了約四個小時的嘗試,得到的結果卻還有一些問題,總之先介紹今晚的過程。

FlexMonkey 我不多作介紹,它定位在為 Flex App 或 AIR App 進行 UI 測試,可進行自動化測試,觀念是先將 UI 操作錄製下來,FlexMonkey 可將一系列的動作轉成 FlexUnit AS3 code,然後就可以被 Ant 執行測試了。

1.
在 FlexMonkey 官網下載安裝 FlexMonkey 5.0.21,
http://www.gorillalogic.com/flexmonkey/choose
直接安裝 AIR 安裝程式即可

原想直接下載其範例作演練,不過它的 Flex Sample Project 與 Basic SWF-loading Project 這兩個範例檔案,要麼不是需要 Flex SDK 4.1,要麼就是發布的時候有錯誤訊息,因為範例中的 QuoteOMatic.swf 沒有附帶 source code,所以也看不出個所以然。

不過,仍可將 Basic SWF-loading Project 範例下載,可參考其檔案結構,包括:
* build.xml
* build.properties
* libs/flexunit*.*

這些檔案,可複製到下面我自己專案中來修改。

2.
開一新 Flex 專案,HelloFlexMonkey,主程式中寫一點簡單程式,按下按鈕後載入 data.xml,然後將資料筆數顯示在文字欄位中,

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx"
      >

 <fx:Script>
  <![CDATA[
   import mx.events.FlexEvent;
   import mx.rpc.events.ResultEvent;
   
   protected function btnLoad_clickHandler(event:MouseEvent):void
   {
    dataService.send();
   }

   protected function dataService_resultHandler(event:ResultEvent):void
   {
    var xml:XML = XML(dataService.lastResult);
    trace(xml["data"].toXMLString());
    
    lblQty.text = xml["data"].length();
   }

  ]]>
 </fx:Script>

 <fx:Declarations>
  <s:HTTPService id="dataService" url="data.xml" resultFormat="e4x"
        result="dataService_resultHandler(event)" />
 </fx:Declarations>
 
 <s:Button id="btnLoad" label="LOAD" click="btnLoad_clickHandler(event)" />
 
 <s:Label id="lblQty" y="50" />
 
</s:Application>

html-template/data.xml:

<datas>
<data name="Ben" age="33" />
<data name="Ryan" age="1" />
</datas>

在 FlashBuilder 開發環境中先測試沒有問題。

3.
開啟 FlexMonkey,建立新專案,並利用專案設定工具來將我的 Flex 專案設定完成,會在 libs 下增加 automation_monkey4.x.swc,並會於編譯參數增加以下項目:

-include-libraries "../libs/automation_monkey4.x.swc" "${flexlib}/libs/automation/automation_spark.swc" "${flexlib}/libs/automation/automation.swc" "${flexlib}/libs/automation/automation_agent.swc" "${flexlib}/libs/automation/automation_dmv.swc"

這樣一來,當我們的 flex 專案再度編譯執行時,便會與 FlexMonkey 連線成功 (應與 LocalConnection 有關),然後我們就可以在 FlexMonkey 中,設定要測試的 Test Suite、Test Case、Test 步驟,與驗證規則等等,設定完後可播放執行看效果,FlexMonkey 便會呼叫我們的 HelloFlexMonkey.swf 做對應的工作,並將測試結果記錄下來。



使用 FlexMonkey 這個 AIR 程式的最後一步驟,就是將所有設定好的測試步驟,進行 Generate FlexUnit Tests,會將對應的 xml、as3 程式碼,產生在我指定的專案目錄下 test 資料夾中。

然後 FlexMonkey 就可以關掉了~

4.
若想在 FlashBuilder 中,立即將剛產生出來的 FlexUnit 測試,整合到 HelloFlexMonkey 專案中執行測試看看的話,要做兩件事情:

* 將 test/tests/src 加入來源程式碼列表
* 在編譯參數中,增加 -includes FlexMonkeyTestController

因為這個類別有 [Mixin] metadata,所以被 -includes 時,就會自動執行。


5.
準備 ant 自動化編譯、測試的部分,

build.properties
# Customize for local environment 

# Flex sdk home
flex.home=C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.0.0

# Main mxml class
main=HelloFlexMonkey

# browser to launch tests
monket.launch.app=C:/Program Files/Mozilla Firefox/firefox.exe

# location of your AS3-based tests. Defaults to tests/src
test.src.dir=test/tests/src

# build output location. Defaults to bin-debug
# build.dir=

# Name of the TextModule. Defaults to "TestModule"
# test=

# Controls whether browser remains open when tests complete. Note that html report won't be generated until browser is closed.Defaults to true
# close.browser=false

build.xml
<?xml version="1.0" encoding="iso8859-1" ?>
<project name="flexmonkey_test" default="build-test" basedir=".">

 <property environment="env"/>

 <!-- Load Environment specific properties from properties file -->
 <property file="build.properties"/>
 <fail unless="flex.home" message="flex.home should be set (in build.properties file)"/> 
 <property name="FLEX_HOME" value="${flex.home}"/>

 <fail unless="main" message="main should be set (in build.properties file)"/> 
 
 <condition property="src.dir" value="src">
     <not><isset property="src.dir" /></not>
 </condition>

 <condition property="test.src.dir" value="tests/src">
     <not><isset property="test.src.dir" /></not>
 </condition>
 
 <condition property="test" value="TestModule">
     <not><isset property="test" /></not>
 </condition>   
    
 <condition property="build.dir" value="${basedir}/bin-debug">
      <not><isset property="build.dir" /></not>
 </condition>
 
 <condition property="close.browser" value="true">
      <not><isset property="close.browser" /></not>
 </condition> 
 
 <property name="docs.dir" value="docs"/>
 <property name="lib.dir" value="libs"/>
 <property name="swc.dir" value="libs"/>
 <property name="report.dir" value="report"/> 
 <property name="flex.ant.loc" value="${flex.home}/ant"/>
 <property name="monkey.snapshots.dir" value="${test.src.dir}/snapshots"/>

 <property name="launcher.url" value="file://${build.dir}/${main}.html" />

 <property name="DEFAULT.LOCAL" value="en_US"/>
 <property name="ENCODING" value="UTF-8"/>

 <!-- set path to Flashplayer logfile -->
 <condition property="FLASHPLAYER_LOG_DIR" value="${user.home}\Application Data\Macromedia\Flash Player\Logs">  
     <os family="windows"/>
 </condition>
 <condition property="FLASHPLAYER_LOG_DIR" value="${user.home}/Library/Preferences/Macromedia/Flash Player/Logs">  
     <os family="mac"/>
 </condition>
 <condition property="FLASHPLAYER_LOG_DIR" value="${user.home}/.macromedia/Flash_Player/Logs">  
     <os family="unix"/>
 </condition>
 <property name="FLASHPLAYER_LOG_FILE" value="${FLASHPLAYER_LOG_DIR}/flashlog.txt"/>
 <available file="${FLASHPLAYER_LOG_FILE}" property="FLASHPLAYER_LOG_FILE_AVAILABLE"/> 
 
 <!-- snapshot directory management -->
 <property name="snapshot.testrun.dir" value="${build.dir}/snapshots"/>
 <property name="snapshot.source.dir" value="${monkey.snapshots.dir}"/>

        <!-- Load the flex tasks for compiling the actionScript code and running flexUnit -->
        <taskdef resource="flexTasks.tasks" classpath="${flex.ant.loc}/lib/flexTasks.jar"/>

 <!-- Location of the Monkey ant tasks -->
 <path id="libraries">
    <fileset dir="${lib.dir}">
       <include name="**/*.jar"/>
    </fileset>
 </path>

 <!-- FlexUnit ant task -->
        <taskdef resource="flexUnitTasks.tasks"
                classpathref="libraries" />

 <!-- setup kill script properties -->
        <condition property="isUnix">
                <os family="unix" />
        </condition> 

        <condition property="KILL_SCRIPT" value="${basedir}/bin/kill.sh" else="">
                <os family="unix"/>
        </condition> 
 
  <!-- Compile Flex files -->
 <target name="clean">
  <delete dir="${snapshot.testrun.dir}"/>
 </target>
 

 <target name="compileApplicationUnderTest" description="Compile the application with the test runner linked in">
            <java jar="${FLEX_HOME}/lib/mxmlc.jar" fork="true" failonerror="true">
                <jvmarg value="-Xmx512m"/> <!-- avoid running out of heap space during compile -->
                <arg value="-debug=true"/>

                <arg value="+flexlib=${FLEX_HOME}/frameworks"/>

                <arg value="-source-path"/>
                <arg value="${src.dir}"/>
                <arg value="${test.src.dir}"/>

                <arg value="-file-specs=${src.dir}/${main}.mxml"/>

                <arg value="-includes"/>
                <arg value="FlexMonkeyTestController"/>

                <arg value="-include-libraries+=${swc.dir}/automation_monkey4.x.swc"/>
                <arg value="-include-libraries+=${swc.dir}/flexunit-aircilistener-4.1.0_RC2-4-4.1.0.16076.swc"/>
                <arg value="-include-libraries+=${swc.dir}/flexunit-4.1.0_RC2-4-flex_4.1.0.16076.swc"/>
                <arg value="-include-libraries+=${swc.dir}/flexunit-cilistener-4.1.0_RC2-4-4.1.0.16076.swc"/>
             
             
             <!--
             [Ben Chang]
             Description
    On some platforms, you need to explicitly include an additional compiler arg
    so that your compiler line should look something like this:
    Flex 4.x
    -locale en_US -include-libraries libs/automation_monkey4.x.swc ${flexlib}/libs/automation/automation_agent.swc
             -->
             <arg value="-include-libraries+=${FLEX_HOME}/frameworks/libs/automation/automation_agent.swc"/>
             

                <arg value="-output=${build.dir}/${main}.swf"/>
            </java>
 </target>
 
 <target name="wrapper"> 
  <html-wrapper
         title="FlexMonkey Testing"
         file="${main}.html"
         height="100%"
         width="100%"
         bgcolor="#ffffff"
         application="${main}"
         swf="${main}"
         version-major="9"
         version-minor="0"
         version-revision="0"
         history="false"
         output="${build.dir}"/>
 </target> 

 <!-- Run the Tests -->
 <target name="cleanReport" depends="wrapper">
        <delete dir="${report.dir}" />
    </target>

 <target name="checkSnapshots">
  <available file="${snapshot.source.dir}" property="snapshots.present"/>
<echo message="snapshot.source.dir=${snapshot.source.dir} snapshots.present=${snapshots.present}"/>
 </target>

 <target name="copySnapshots" depends="checkSnapshots" if="snapshots.present">
  <copy todir="${snapshot.testrun.dir}" overwrite="true">
   <fileset dir="${snapshot.source.dir}"/>
  </copy>
 </target>

 <target name="initTest" depends="cleanReport,copySnapshots">
  <copy todir="${build.dir}" overwrite="true">
   <!--<fileset file="html-template/QuoteOMatic.swf"/>-->
   <fileset file="html-template/data.xml"/>
  </copy>
  <mkdir dir="${report.dir}" />
 </target>

 <target name="test" depends="execute_test, check_flash_log, show_flash_log"/>
 
 <target name="execute_test" depends="initTest">       
  <echo>${build.dir}/${main}.swf</echo>
  <flexunit 
   url="file://${build.dir}/${main}.swf"
   command="C:/Program Files/Mozilla Firefox/firefox.exe"
                        toDir="${report.dir}"
                        haltonfailure="false"
                        verbose="true"
      localTrusted="true"
   />

  
      <junitreport todir="${report.dir}">
   <fileset dir="${report.dir}">
           <include name="TEST-*.xml"/>
   </fileset> 
   <report format="frames" todir="${report.dir}/html"/>
      </junitreport>    
 </target>
 
 <!--  capture the Flash log file -->
 <target name="show_flash_log" if="${FLASHPLAYER_LOG_FILE_EXISTS}" >
  <echo>*************** begin Flash Player Log File output *************</echo>
  <concat><fileset file="${FLASHPLAYER_LOG_FILE}"/></concat>
  <echo>***************  end  Flash Player Log File output *************</echo>
 </target>

 <target name="check_flash_log">
  <available file="${FLASHPLAYER_LOG_FILE}" property="FLASHPLAYER_LOG_FILE_EXISTS"/>
 </target>
 
 <target name="build" depends="compileApplicationUnderTest"/>  
 <target name="clean-build-test" depends="clean,build,test"/>  
 <target name="build-test" depends="build,test"/>   
</project>

這份 build.xml 中,有幾個地方被我改過,

[1] target "compileApplicationUnderTest" 中,需要增加一項參數

<arg value="-include-libraries+=${FLEX_HOME}/frameworks/libs/automation/automation_agent.swc"/>

這是參考官網的 FAQ 調整的。

[2] target "initTest" 中,因為現在用不到 QuoteOMatic.swf,而是使用我這個範例定義的 data.xml,所以有做了對應的檔案複製作業的調整。

[3] target "execute_test" 中,執行 flexunit 做測試時,參數 command 原本是 "${monket.launch.app}",但是總是無法代換成我在 build.properties 中設定的 firefox 路徑,所以只好先直接寫死。



有了這份 build file 後,就可以在本機進行編譯、測試等工作。下一步就可以放到 SVN 上了。


6.
在 Hudson 的部分,新建一個專案,相關設定如下:

SVN:

ANT:

UnitTest Report:

7.
第一次進行手動建置,發現以下錯誤:

execute_test:
     [echo] C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace/bin-debug/HelloFlexMonkey.swf
 [flexunit] Validating task attributes ...
 [flexunit] Generating default values ...
 [flexunit] Using default working dir [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace]
 [flexunit] Using the following settings for the test run:
 [flexunit]  FLEX_HOME: [C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.0.0]
 [flexunit]  haltonfailure: [false]
 [flexunit]  headless: [false]
 [flexunit]  display: [99]
 [flexunit]  localTrusted: [true]
 [flexunit]  player: [flash]
 [flexunit]  command: [C:\Program Files\Mozilla Firefox\firefox.exe]
 [flexunit]  port: [1024]
 [flexunit]  swf: [null]
 [flexunit]  timeout: [60000ms]
 [flexunit]  toDir: [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\report]
 [flexunit] Setting up server process ...
 [flexunit] Starting server ...
 [flexunit] Opening server socket on port [1024].
 [flexunit] Waiting for client connection ...
 [flexunit] Updated local trust file at [C:\Users\ben\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust\flexUnit.cfg], added [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\file:\C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug].
 [flexunit] Executing 'C:\Program Files\Mozilla Firefox\firefox.exe' with arguments:
 [flexunit] 'file://C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace/bin-debug/HelloFlexMonkey.swf'
 [flexunit] 
 [flexunit] The ' characters around the executable and arguments are
 [flexunit] not part of the command.
 [flexunit] 
 [flexunit] Client connected.
 [flexunit] Setting inbound buffer size to [262144] bytes.
 [flexunit] Receiving data ...
 [flexunit] Sending acknowledgement to player to start sending test data ...
 [flexunit] 
 [flexunit] 
 [flexunit] Stopping server ...
 [flexunit] End of test data reached, sending acknowledgement to player ...
 [flexunit] Closing client connection ...
 [flexunit] Closing server on port [1024] ...

BUILD FAILED
C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\build.xml:177: java.util.concurrent.ExecutionException: command [] not understood
 at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
 at java.util.concurrent.FutureTask.get(FutureTask.java:83)
 at org.flexunit.ant.tasks.TestRun.run(Unknown Source)
 at org.flexunit.ant.tasks.FlexUnitTask.execute(Unknown Source)
 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 at org.apache.tools.ant.Task.perform(Task.java:348)
 at org.apache.tools.ant.Target.execute(Target.java:390)
 at org.apache.tools.ant.Target.performTasks(Target.java:411)
 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
 at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
 at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
 at org.apache.tools.ant.Main.runBuild(Main.java:809)
 at org.apache.tools.ant.Main.startAnt(Main.java:217)
 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: command [] not understood
 at org.flexunit.ant.FlexUnitSocketThread.parseInboundMessages(Unknown Source)
 at org.flexunit.ant.FlexUnitSocketThread.call(Unknown Source)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)

參考了討論區的說明:
http://forums.adobe.com/thread/553516

原因是,當 Ant 使用 FlexUnit 進行測試時,會開 1024 port 來與本機 Flash Player 所測試的 swf 做溝通,會有一些安全性問題需要考量。

這部分,FlexUnit 官網的說明是:
http://docs.flexunit.org/index.php?title=Ant_Task

localTrusted -- DEFAULT: true (4.0.0)
-- Setting this attribute to true will add the path passed into the "swf" attribute to the local FlashPlayer Trust. This trust entry is made in the flexUnit.cfg file on your machine's local trust folder for the Flash Player. If this attribute is set to false, the flexUnit.cfg file will be removed.
-- On Linux, make sure that that the user executing the Ant script has a home folder and its HOME environment variable is declared. Currently running the script as the root user is not supported. Fix pending...
-- Excluded if using player="air".

不過,從 Hudson 的 log 來看,不知道為何,它在 flexUnit.cfg 中寫入的路徑資料怪怪的:

[flexunit] Updated local trust file at [C:\Users\ben\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust\flexUnit.cfg], added [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\file:\C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug].

在 flexUnit.cfg 的長像:

C:\works\HelloFlexMonkey\file:\C:\works\HelloFlexMonkey\bin-debug
C:\works\test\file:\C:\works\test\bin-debug
C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\file:\C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug

因此,我先手動加一筆:

C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug

再次手動編譯,便可 Ant + FlexUnit 便可順利與 FireFox 裡的 swf 溝通完成測試作業。

完整畫面輸出:

Started by user anonymous
Updating http://127.0.0.1:8100/svn/HelloFlexMonkey/trunk revision: 2011/8/8 上午 01:10:56 depth:infinity ignoreExternals: false
At revision 5
no change for http://127.0.0.1:8100/svn/HelloFlexMonkey/trunk since the previous build
[workspace] $ cmd.exe /C '"ant.bat build-test && exit %%ERRORLEVEL%%"'
Buildfile: C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\build.xml

compileApplicationUnderTest:
     [java] 正在裝載組態檔案“C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.0.0\frameworks\flex-config.xml”
     [java] C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug\HelloFlexMonkey.swf (1738423 個位元組)

build:

wrapper:

cleanReport:
   [delete] Deleting directory C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\report

checkSnapshots:
     [echo] snapshot.source.dir=test/tests/src/snapshots snapshots.present=true

copySnapshots:
     [copy] Copying 1 file to C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug\snapshots

initTest:
     [copy] Copying 1 file to C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug
    [mkdir] Created dir: C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\report

execute_test:
     [echo] C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace/bin-debug/HelloFlexMonkey.swf
 [flexunit] Validating task attributes ...
 [flexunit] Generating default values ...
 [flexunit] Using default working dir [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace]
 [flexunit] Using the following settings for the test run:
 [flexunit]  FLEX_HOME: [C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.0.0]
 [flexunit]  haltonfailure: [false]
 [flexunit]  headless: [false]
 [flexunit]  display: [99]
 [flexunit]  localTrusted: [true]
 [flexunit]  player: [flash]
 [flexunit]  command: [C:\Program Files\Mozilla Firefox\firefox.exe]
 [flexunit]  port: [1024]
 [flexunit]  swf: [null]
 [flexunit]  timeout: [60000ms]
 [flexunit]  toDir: [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\report]
 [flexunit] Setting up server process ...
 [flexunit] Starting server ...
 [flexunit] Opening server socket on port [1024].
 [flexunit] Waiting for client connection ...
 [flexunit] Entry [C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\file:\C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\bin-debug] already available in local trust file at [C:\Users\ben\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust\flexUnit.cfg].
 [flexunit] Executing 'C:\Program Files\Mozilla Firefox\firefox.exe' with arguments:
 [flexunit] 'file://C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace/bin-debug/HelloFlexMonkey.swf'
 [flexunit] 
 [flexunit] The ' characters around the executable and arguments are
 [flexunit] not part of the command.
 [flexunit] 
 [flexunit] Client connected.
 [flexunit] Setting inbound buffer size to [262144] bytes.
 [flexunit] Receiving data ...
 [flexunit] Sending acknowledgement to player to start sending test data ...
 [flexunit] 
 [flexunit] 
 [flexunit] Stopping server ...
 [flexunit] End of test data reached, sending acknowledgement to player ...
 [flexunit] Closing client connection ...
 [flexunit] Closing server on port [1024] ...
 [flexunit] Analyzing reports ...
 [flexunit] 
 [flexunit] Suite: testSuites.simpleTestSuite.testCases.tests.TestLoadingData
 [flexunit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.977 sec
 [flexunit] 
 [flexunit] Results :
 [flexunit] 
 [flexunit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.977 sec
 [flexunit] 
[junitreport] Processing C:\Users\ben\.hudson\jobs\HelloFlexMonkey\workspace\report\TESTS-TestSuites.xml to C:\Users\ben\AppData\Local\Temp\null1688806052
[junitreport] Loading stylesheet jar:file:/C:/apache-ant-1.8.2/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 405ms
[junitreport] Deleting: C:\Users\ben\AppData\Local\Temp\null1688806052

check_flash_log:

show_flash_log:
     [echo] *************** begin Flash Player Log File output *************
   [concat] 霅血?: ?仿? http://fpdownload.adobe.com/pub/swz/crossdomain.xml ?????找? 'secure' ?寡釭??secure' ?寡釭?芸?閮曹蝙?冽 HTTPS ??Socket ??瑼?憒?閰喟敦鞈?嚗?? http://www.adobe.com/go/strict_policy_files_tw??
   [concat] MonkeyLink version 5.0.21
   [concat] testSuites.simpleTestSuite.testCases.tests::TestLoadingData.testLoadingDataTest .
   [concat] TestLoadingData.testLoadingDataTest
   [concat] testSuites.simpleTestSuite.testCases.tests::TestLoadingData (Click: LOAD)
   [concat] AutomationHelper:getAppTitle() - In AIR we are supposed to have class 'mx.automation.air.AirFunctionsHelper' with appTitle property.
   [concat] 
   [concat] 
   [concat] testSuites.simpleTestSuite.testCases.tests::TestLoadingData (New Verify)
   [concat] finished: Custom Test
   [concat] FlexMonkeyCustomTestBase: nested test ended
   [concat] 
   [concat] 
   [concat] Time: 2.985
   [concat] OK (1 test )
     [echo] ***************  end  Flash Player Log File output *************

test:

build-test:

BUILD SUCCESSFUL
Total time: 28 seconds
Recording test results
[DEBUG] Skipping watched dependency update; build not configured with trigger: HelloFlexMonkey #8
Finished: SUCCESS

且可於專案管理介面中,看到 FlexUnit 測試結果產出的 JUnit report。





下一步,可以研究的問題是:

* 上述步驟中,一些奇怪問題的造成原因,是否設定方式要如何進行

* 下一個問題是,當 Hudson 是以 Window Service 的方式在執行時,之前有看到國外有討論會有安全性的問題,或是要採用 RDP 與 VNC 之間的選擇。

沒有留言: